fixed a problem in the iterator as pointed out by Jesse.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1645 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-01-05 05:52:57 +00:00
1 parent e68917b5f3
commit 1d62e9c259
1 file changed
+19 -1
@@ -44,7 +44,25 @@ public class CopyOnWriteList<E> implements Iterable<E> {
return r;
}
/**
* Returns an iterator.
*
* The returned iterator doesn't support the <tt>remove</tt> operation.
*/
public Iterator<E> iterator() {
return core.iterator();
final Iterator<E> itr = core.iterator();
return new Iterator<E>() {
public boolean hasNext() {
return itr.hasNext();
}
public E next() {
return itr.next();
}
public void remove() {
throw new UnsupportedOperationException();
}
};
}
}