add TreeSet(Collection) constructor

This commit is contained in:
Joel Dice
2011-01-20 09:39:16 -07:00
parent 0ca7ed8c67
commit 3aff7dc861
2 changed files with 18 additions and 0 deletions

View File

@ -33,6 +33,14 @@ public class TreeSet<T> extends AbstractSet<T> implements Collection<T> {
}
});
}
public TreeSet(Collection<? extends T> collection) {
this();
for (T item: collection) {
add(item);
}
}
public Iterator<T> iterator() {
return new MyIterator<T>(set.first());