@Test public void testSetCurrentUuid() throws Exception { final String UUID_STRING1 = "uuidstring1"; final String UUID_STRING2 = "uuidstring2"; final String UUID_STRING3 = "uuidstring3"; UUIDIterator iterator = new UUIDIterator(); iterator.addUUID(UUID_STRING1); iterator.addUUID(UUID_STRING2); assertEquals(2, iterator.size()); assertEquals(UUID_STRING1, iterator.getUUID()); iterator.setCurrentUUID(UUID_STRING2); assertEquals(UUID_STRING2, iterator.getUUID()); assertEquals(2, iterator.size()); iterator.setCurrentUUID(UUID_STRING3); assertEquals(UUID_STRING3, iterator.getUUID()); assertEquals(3, iterator.size()); }
public synchronized void setCurrentUUID(String uuid) { for (UUIDItem item : uuids) { if (item.uuid.equals(uuid)) { currentUUID = item; return; } } UUIDItem entry = new UUIDItem(uuid); uuids.add(entry); currentUUID = entry; return; }
UUIDIterator { public synchronized void setCurrentUUID(String uuid) { for (UUIDItem item : uuids) { if (item.uuid.equals(uuid)) { currentUUID = item; return; } } UUIDItem entry = new UUIDItem(uuid); uuids.add(entry); currentUUID = entry; return; } }
UUIDIterator { public synchronized void setCurrentUUID(String uuid) { for (UUIDItem item : uuids) { if (item.uuid.equals(uuid)) { currentUUID = item; return; } } UUIDItem entry = new UUIDItem(uuid); uuids.add(entry); currentUUID = entry; return; } UUIDIterator();  UUIDIterator(Collection<String> uuids); }
UUIDIterator { public synchronized void setCurrentUUID(String uuid) { for (UUIDItem item : uuids) { if (item.uuid.equals(uuid)) { currentUUID = item; return; } } UUIDItem entry = new UUIDItem(uuid); uuids.add(entry); currentUUID = entry; return; } UUIDIterator();  UUIDIterator(Collection<String> uuids); synchronized void addUUID(String uuid); synchronized void addUUIDs(Collection<String> uuids); synchronized void clear(); synchronized void clearAndAddUUID(String uuid); synchronized void clearAndAddUUIDs(Collection<String> uuids); synchronized String debugString(); synchronized String getUUID(); synchronized void markUUIDAsFailed(String uuid); synchronized void setCurrentUUID(String uuid); synchronized int size(); }
UUIDIterator { public synchronized void setCurrentUUID(String uuid) { for (UUIDItem item : uuids) { if (item.uuid.equals(uuid)) { currentUUID = item; return; } } UUIDItem entry = new UUIDItem(uuid); uuids.add(entry); currentUUID = entry; return; } UUIDIterator();  UUIDIterator(Collection<String> uuids); synchronized void addUUID(String uuid); synchronized void addUUIDs(Collection<String> uuids); synchronized void clear(); synchronized void clearAndAddUUID(String uuid); synchronized void clearAndAddUUIDs(Collection<String> uuids); synchronized String debugString(); synchronized String getUUID(); synchronized void markUUIDAsFailed(String uuid); synchronized void setCurrentUUID(String uuid); synchronized int size();  }