diff options
Diffstat (limited to 'models-tosca/src/main/java')
-rw-r--r-- | models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java index 77633bd27..88591bd91 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java @@ -21,13 +21,11 @@ package org.onap.policy.models.tosca.utils; import java.util.Collection; +import java.util.HashSet; import java.util.Set; import java.util.function.Function; - import javax.ws.rs.core.Response; - import lombok.NonNull; - import org.apache.commons.collections4.CollectionUtils; import org.onap.policy.models.base.PfConcept; import org.onap.policy.models.base.PfConceptContainer; @@ -263,9 +261,11 @@ public final class ToscaUtils { @SuppressWarnings("unchecked") Set<JpaToscaEntityType<?>> filteredEntitySet = - (Set<JpaToscaEntityType<?>>) entityTypes.getAll(entityName, entityVersion); + (Set<JpaToscaEntityType<?>>) entityTypes.getAll(entityName, entityVersion); + Set<JpaToscaEntityType<?>> filteredEntitySetToReturn = new HashSet<>(filteredEntitySet); for (JpaToscaEntityType<?> filteredEntityType : filteredEntitySet) { - filteredEntitySet.addAll(ToscaUtils.getEntityTypeAncestors(entityTypes, filteredEntityType, result)); + filteredEntitySetToReturn + .addAll(ToscaUtils.getEntityTypeAncestors(entityTypes, filteredEntityType, result)); } if (!result.isValid()) { @@ -273,6 +273,6 @@ public final class ToscaUtils { } entityTypes.getConceptMap().entrySet() - .removeIf(entityEntry -> !filteredEntitySet.contains(entityEntry.getValue())); + .removeIf(entityEntry -> !filteredEntitySetToReturn.contains(entityEntry.getValue())); } } |