Add Collections#synchronizedSet

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2013-10-25 13:27:09 -05:00
parent 526dd574d9
commit 86c735e649

View File

@ -245,6 +245,10 @@ public class Collections {
}
}
public static <V> Set<V> synchronizedSet(Set<V> set) {
return new SynchronizedSet<V> (new Object(), set);
}
static class SynchronizedIterator<T> implements Iterator<T> {
private final Object lock;
private final Iterator<T> it;