mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
Adds some missing methods to TreeSet, which really ought to be an instance of Collection
This commit is contained in:
parent
0a5de853d3
commit
6be84b4653
@ -1,6 +1,6 @@
|
||||
package java.util;
|
||||
|
||||
public class TreeSet<T> implements Iterable<T> {
|
||||
public class TreeSet<T> implements Collection<T> {
|
||||
private PersistentSet<Cell<T>> set;
|
||||
private int size;
|
||||
|
||||
@ -59,6 +59,15 @@ public class TreeSet<T> implements Iterable<T> {
|
||||
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 PersistentSet.Path<Cell<T>> path;
|
||||
private PersistentSet.Path<Cell<T>> nextPath;
|
||||
|
Loading…
Reference in New Issue
Block a user