From: Chris André Date: Tue, 28 Apr 2020 21:49:54 +0000 (-0400) Subject: Replace call to `get` with a call to `ifPresent` X-Git-Tag: 1.7.0~187 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F73%2F106773%2F2;p=sdc.git Replace call to `get` with a call to `ifPresent` Issue-ID: SDC-2989 Signed-off-by: Chris Andre Change-Id: I7fe273d869035f8852dbc398de60cc49dec2ce6e --- 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, ComponentInstance> componentInstLocations, Map> connectedCps) { for (Entry> vfcCpList : connectedCps.entrySet()) { - Entry, 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 vfcLocation, List cpsGroup, Map, ComponentInstance> componentInstLocations) {