Use for-each statement
Change-Id: Ib89f3372caebc30542739c0eba62f67ef56a4d4e
Showing
3 changed files
with
6 additions
and
13 deletions
... | @@ -606,17 +606,14 @@ public class SimpleGroupStore | ... | @@ -606,17 +606,14 @@ public class SimpleGroupStore |
606 | + "southboundGroupEntries for device {}", | 606 | + "southboundGroupEntries for device {}", |
607 | southboundGroupEntries.size(), | 607 | southboundGroupEntries.size(), |
608 | deviceId); | 608 | deviceId); |
609 | - for (Iterator<Group> it = southboundGroupEntries.iterator(); it.hasNext();) { | 609 | + for (Group group : southboundGroupEntries) { |
610 | - Group group = it.next(); | ||
611 | log.trace("Group {} in device {}", group, deviceId); | 610 | log.trace("Group {} in device {}", group, deviceId); |
612 | } | 611 | } |
613 | 612 | ||
614 | log.trace("Displaying all ({}) stored group entries for device {}", | 613 | log.trace("Displaying all ({}) stored group entries for device {}", |
615 | storedGroupEntries.size(), | 614 | storedGroupEntries.size(), |
616 | deviceId); | 615 | deviceId); |
617 | - for (Iterator<Group> it1 = storedGroupEntries.iterator(); | 616 | + for (Group group : storedGroupEntries) { |
618 | - it1.hasNext();) { | ||
619 | - Group group = it1.next(); | ||
620 | log.trace("Stored Group {} for device {}", group, deviceId); | 617 | log.trace("Stored Group {} for device {}", group, deviceId); |
621 | } | 618 | } |
622 | 619 | ... | ... |
... | @@ -1261,17 +1261,14 @@ public class DistributedGroupStore | ... | @@ -1261,17 +1261,14 @@ public class DistributedGroupStore |
1261 | log.trace("pushGroupMetrics: Displaying all ({}) southboundGroupEntries for device {}", | 1261 | log.trace("pushGroupMetrics: Displaying all ({}) southboundGroupEntries for device {}", |
1262 | southboundGroupEntries.size(), | 1262 | southboundGroupEntries.size(), |
1263 | deviceId); | 1263 | deviceId); |
1264 | - for (Iterator<Group> it = southboundGroupEntries.iterator(); it.hasNext();) { | 1264 | + for (Group group : southboundGroupEntries) { |
1265 | - Group group = it.next(); | ||
1266 | log.trace("Group {} in device {}", group, deviceId); | 1265 | log.trace("Group {} in device {}", group, deviceId); |
1267 | } | 1266 | } |
1268 | 1267 | ||
1269 | log.trace("Displaying all ({}) stored group entries for device {}", | 1268 | log.trace("Displaying all ({}) stored group entries for device {}", |
1270 | storedGroupEntries.size(), | 1269 | storedGroupEntries.size(), |
1271 | deviceId); | 1270 | deviceId); |
1272 | - for (Iterator<StoredGroupEntry> it1 = storedGroupEntries.iterator(); | 1271 | + for (StoredGroupEntry group : storedGroupEntries) { |
1273 | - it1.hasNext();) { | ||
1274 | - Group group = it1.next(); | ||
1275 | log.trace("Stored Group {} for device {}", group, deviceId); | 1272 | log.trace("Stored Group {} for device {}", group, deviceId); |
1276 | } | 1273 | } |
1277 | 1274 | ... | ... |
... | @@ -82,9 +82,8 @@ public class PersistentSet<E> implements Set<E> { | ... | @@ -82,9 +82,8 @@ public class PersistentSet<E> implements Set<E> { |
82 | public Object[] toArray() { | 82 | public Object[] toArray() { |
83 | Object[] retArray = new Object[items.size()]; | 83 | Object[] retArray = new Object[items.size()]; |
84 | int index = 0; | 84 | int index = 0; |
85 | - Iterator<byte[]> iterator = items.iterator(); | 85 | + for (byte[] item : items) { |
86 | - while (iterator.hasNext()) { | 86 | + retArray[index] = serializer.decode(item); |
87 | - retArray[index] = serializer.decode(iterator.next()); | ||
88 | index++; | 87 | index++; |
89 | } | 88 | } |
90 | return retArray; | 89 | return retArray; | ... | ... |
-
Please register or login to post a comment