diff options
author | Chris André <chris.andre@yoppworks.com> | 2020-04-28 17:49:54 -0400 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-04-30 14:00:50 +0000 |
commit | 8c5a1d6591d0faf2bdd0de528f42863ae1594c4f (patch) | |
tree | 31446eac9029fb868d8073af80931f06102dd9eb /catalog-be/src/main/java/org | |
parent | 7dec12b47ec34baec6d31dac3f2961e90e721632 (diff) |
Replace call to `get` with a call to `ifPresent`
Issue-ID: SDC-2989
Signed-off-by: Chris Andre <chris.andre@yoppworks.com>
Change-Id: I7fe273d869035f8852dbc398de60cc49dec2ce6e
Diffstat (limited to 'catalog-be/src/main/java/org')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java index 14a193fde4..0790c4b8bf 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java @@ -139,10 +139,13 @@ public class CompositionBusinessLogic { protected void buildCirclePatternForCps(Map<ImmutablePair<Double, Double>, ComponentInstance> componentInstLocations, Map<ComponentInstance, List<ComponentInstance>> connectedCps) { for (Entry<ComponentInstance, List<ComponentInstance>> vfcCpList : connectedCps.entrySet()) { - Entry<ImmutablePair<Double, Double>, ComponentInstance> vfcOfTheCps = componentInstLocations.entrySet().stream().filter(p -> p.getValue().getUniqueId().equals(vfcCpList.getKey().getUniqueId())).findAny().get(); - buildCirclePatternForOneGroupOfCps(vfcOfTheCps.getKey(), vfcCpList.getValue(), componentInstLocations); + componentInstLocations.entrySet().stream() + .filter(p -> p.getValue().getUniqueId().equals(vfcCpList.getKey().getUniqueId())) + .findAny() + .ifPresent(vfcOfTheCps -> + buildCirclePatternForOneGroupOfCps(vfcOfTheCps.getKey(), vfcCpList.getValue(), + componentInstLocations)); } - } private void buildCirclePatternForOneGroupOfCps(ImmutablePair<Double, Double> vfcLocation, List<ComponentInstance> cpsGroup, Map<ImmutablePair<Double, Double>, ComponentInstance> componentInstLocations) { |