From 8c5a1d6591d0faf2bdd0de528f42863ae1594c4f Mon Sep 17 00:00:00 2001 From: Chris André Date: Tue, 28 Apr 2020 17:49:54 -0400 Subject: Replace call to `get` with a call to `ifPresent` Issue-ID: SDC-2989 Signed-off-by: Chris Andre Change-Id: I7fe273d869035f8852dbc398de60cc49dec2ce6e --- .../sdc/be/components/impl/CompositionBusinessLogic.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'catalog-be') 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) { -- cgit 1.2.3-korg