changeset 279:2e1d9854a6d6

Refactor iterating process with for-each sentence.
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Fri, 18 Oct 2013 02:02:12 +0900
parents 04c769f00be1
children f60c00746ff6
files src/alice/test/topology/share/CheckLocalIndex.java
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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<String> r = list.asClass(List.class);
 		int count = 0;
 		boolean flag = false;
-		for (Iterator<String> 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);