From bb9cc6b851572a3b756f65738034e546bd33e17d Mon Sep 17 00:00:00 2001 From: Munir Ahmad Date: Sat, 24 Feb 2018 12:42:55 -0500 Subject: Swap while loops with foreach where applicable Change-Id: Id3b54e8192f0e60657aa4c50af56c1ef98fbff5e Issue-ID: SO-437 Signed-off-by: Munir Ahmad --- .../org/openecomp/mso/asdc/util/YamlEditor.java | 33 ++++++++++------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'asdc-controller/src') diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java index f94e0a153b..a90fdeb8e6 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java @@ -82,12 +82,10 @@ public class YamlEditor { @SuppressWarnings("unchecked") Map resourceMap = (Map ) yml.get ("resources"); - Iterator > it = resourceMap.entrySet ().iterator (); - while (it.hasNext ()) { - Map.Entry pair = it.next (); + for (Entry pair : resourceMap.entrySet()) { @SuppressWarnings("unchecked") - Map resourceEntry = (Map ) pair.getValue (); - typeList.add (resourceEntry.get ("type")); + Map resourceEntry = (Map) pair.getValue(); + typeList.add(resourceEntry.get("type")); } return typeList; } @@ -100,28 +98,27 @@ public class YamlEditor { Set paramSet = new HashSet (); @SuppressWarnings("unchecked") Map resourceMap = (Map ) yml.get ("parameters"); - Iterator > it = resourceMap.entrySet ().iterator (); - while (it.hasNext ()) { - HeatTemplateParam param = new HeatTemplateParam (); - Map.Entry pair = it.next (); + for (Entry stringObjectEntry : resourceMap.entrySet()) { + HeatTemplateParam param = new HeatTemplateParam(); + Entry pair = stringObjectEntry; @SuppressWarnings("unchecked") - Map resourceEntry = (Map ) pair.getValue (); - - param.setParamName (pair.getKey ()); + Map resourceEntry = (Map) pair.getValue(); + + param.setParamName(pair.getKey()); // System.out.println(pair.getKey()+":"+type); if (resourceEntry.containsKey("default")) { - param.setRequired (false); + param.setRequired(false); } else { - param.setRequired (true); + param.setRequired(true); } // Now set the type - String value = resourceEntry.get ("type"); - param.setParamType (value); - + String value = resourceEntry.get("type"); + param.setParamType(value); + param.setHeatTemplateArtifactUuid(artifactUUID); - paramSet.add (param); + paramSet.add(param); } return paramSet; -- cgit 1.2.3-korg