Merge branch 'master' of dice:git/vm

This commit is contained in:
Joel Dice 2007-10-16 12:16:19 -06:00
commit 4b9bcd97c1

View File

@ -1,6 +1,6 @@
package java.util; package java.util;
public class TreeSet<T> implements Iterable<T> { public class TreeSet<T> implements Collection<T> {
private PersistentSet<Cell<T>> set; private PersistentSet<Cell<T>> set;
private int size; private int size;
@ -59,6 +59,15 @@ public class TreeSet<T> implements Iterable<T> {
return size; return size;
} }
public boolean contains(T value) {
return !set.find(new Cell(value, null)).fresh();
}
public void clear() {
set = new PersistentSet(set.comparator());
size = 0;
}
private class MyIterator<T> implements java.util.Iterator<T> { private class MyIterator<T> implements java.util.Iterator<T> {
private PersistentSet.Path<Cell<T>> path; private PersistentSet.Path<Cell<T>> path;
private PersistentSet.Path<Cell<T>> nextPath; private PersistentSet.Path<Cell<T>> nextPath;