Fix some code smells 83/134783/1
authorhalil.cakal <halil.cakal@est.tech>
Wed, 7 Jun 2023 10:02:30 +0000 (11:02 +0100)
committerhalil.cakal <halil.cakal@est.tech>
Wed, 7 Jun 2023 10:02:50 +0000 (11:02 +0100)
Issue-ID: CPS-1507
Change-Id: Ic11ccbb37538242cb65ab1dbdde4fc77d9f94bdf
Signed-off-by: halil.cakal <halil.cakal@est.tech>
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/avc/SubscriptionOutcomeMapper.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/DataNodeHelper.java

index 2466bc3..136c1d6 100644 (file)
@@ -54,7 +54,7 @@ public interface SubscriptionOutcomeMapper {
     default List<Object> mapStatusToCmHandleRejected(Map<String, SubscriptionStatus> targets) {
         return targets.entrySet()
                 .stream().filter(target -> SubscriptionStatus.REJECTED.equals(target.getValue()))
-                .map(target -> target.getKey())
+                .map(Map.Entry::getKey)
                 .collect(Collectors.toList());
     }
 
@@ -68,7 +68,7 @@ public interface SubscriptionOutcomeMapper {
     default List<Object> mapStatusToCmHandleAccepted(Map<String, SubscriptionStatus> targets) {
         return targets.entrySet()
                 .stream().filter(target -> SubscriptionStatus.ACCEPTED.equals(target.getValue()))
-                .map(target -> target.getKey())
+                .map(Map.Entry::getKey)
                 .collect(Collectors.toList());
     }
 
@@ -82,7 +82,7 @@ public interface SubscriptionOutcomeMapper {
     default List<Object> mapStatusToCmHandlePending(Map<String, SubscriptionStatus> targets) {
         return targets.entrySet()
                 .stream().filter(target -> SubscriptionStatus.PENDING.equals(target.getValue()))
-                .map(target -> target.getKey())
+                .map(Map.Entry::getKey)
                 .collect(Collectors.toList());
     }
 }
index 2fec59b..1648ac4 100644 (file)
@@ -53,7 +53,7 @@ public class DataNodeHelper {
     public static List<Map<String, Serializable>> getDataNodeLeaves(final Collection<DataNode> dataNodes) {
         return dataNodes.stream()
                 .flatMap(DataNodeHelper::flatten)
-                .map(node -> node.getLeaves())
+                .map(DataNode::getLeaves)
                 .collect(Collectors.toList());
     }
 
@@ -66,10 +66,10 @@ public class DataNodeHelper {
     public static List<Collection<Serializable>> getCmHandleIdToStatus(
             final List<Map<String, Serializable>> dataNodeLeaves) {
         return dataNodeLeaves.stream()
-                .map(target -> target.values())
+                .map(Map::values)
                 .filter(col -> col.contains("PENDING")
-                        | col.contains("ACCEPTED")
-                        | col.contains("REJECTED"))
+                        || col.contains("ACCEPTED")
+                        || col.contains("REJECTED"))
                 .collect(Collectors.toList());
     }
 }