From 0c4373663e22ffa18d953b2a9ee6f6b27d559bea Mon Sep 17 00:00:00 2001 From: Munir Ahmad Date: Wed, 7 Mar 2018 18:59:13 -0500 Subject: Make use of lambda Change-Id: I482b874a3e7e686068450c7b5ddf45e2b8ae0d47 Issue-ID: SO-437 Signed-off-by: Munir Ahmad --- .../installer/heat/ToscaResourceInstaller.java | 57 ++++++++++------------ 1 file changed, 26 insertions(+), 31 deletions(-) (limited to 'asdc-controller/src/main/java/org/openecomp/mso/asdc/installer') diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java index 591db355c5..8c08d3eb26 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java @@ -419,39 +419,34 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller { toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID); logger.debug("vfGroups:" + vfGroups.toString()); - vfGroups.sort(new Comparator() { - - @Override - public int compare(Group group1, - Group group2) { - - // Field name1Field = group1.class.getDeclaredField("name"); - // name1Field.setAccessible(true); - String thisName = group1.getName(); // (String) - // name1Field.get(group1); - String thatName = group2.getName(); // (String) - // name1Field.get(group2); - - Matcher m = lastDigit.matcher(thisName); - Matcher m2 = lastDigit.matcher(thatName); - - String thisDigit = "0"; - String thatDigit = "0"; - if (m.find()) { - thisDigit = m.group(); - } else { - return -1; - } - if (m2.find()) { - thatDigit = m2.group(); - } else { - return 1; - } + vfGroups.sort((group1, group2) -> { + + // Field name1Field = group1.class.getDeclaredField("name"); + // name1Field.setAccessible(true); + String thisName = group1.getName(); // (String) + // name1Field.get(group1); + String thatName = group2.getName(); // (String) + // name1Field.get(group2); + + Matcher m = lastDigit.matcher(thisName); + Matcher m2 = lastDigit.matcher(thatName); + + String thisDigit = "0"; + String thatDigit = "0"; + if (m.find()) { + thisDigit = m.group(); + } else { + return -1; + } + if (m2.find()) { + thatDigit = m2.group(); + } else { + return 1; + } - return new Integer(thisDigit).compareTo(new Integer(thatDigit)); + return new Integer(thisDigit).compareTo(new Integer(thatDigit)); - } - }); + }); logger.debug("vfGroupsAfter:" + vfGroups.toString()); -- cgit 1.2.3-korg