# HG changeset patch # User kazz # Date 1382029332 -32400 # Node ID 2e1d9854a6d66be8f7531ebe6e33cbc54dbea25a # Parent 04c769f00be1fe040cf5162f9a2d912a3184b377 Refactor iterating process with for-each sentence. diff -r 04c769f00be1 -r 2e1d9854a6d6 src/alice/test/topology/share/CheckLocalIndex.java --- a/src/alice/test/topology/share/CheckLocalIndex.java Fri Oct 18 01:57:43 2013 +0900 +++ b/src/alice/test/topology/share/CheckLocalIndex.java Fri Oct 18 02:02:12 2013 +0900 @@ -14,7 +14,7 @@ private Receiver host = ids.create(CommandType.PEEK); - public CheckLocalIndex(String key, int index){ + public CheckLocalIndex(String key, int index) { this.host.setKey("host"); this.list.setKey("_CLIST"); this.data.setKey(key, index); @@ -26,18 +26,16 @@ List r = list.asClass(List.class); int count = 0; boolean flag = false; - for (Iterator ir = r.iterator();ir.hasNext();) { - String node = ir.next(); - if (node.equals("parent")){ - flag=true; + for (String node : r) { + if (node.equals("parent")) { + flag = true; } - if (!node.equals(this.data.from)){ + if (!node.equals(this.data.from)) { ods.update(node, data.key, data.getVal()); count++; } - } - if (count==0&&flag){ + if (count == 0 && flag) { ods.put("parent", "data", data.getVal()); } new CheckLocalIndex(data.key, data.index);