mirror of
https://github.com/corda/corda.git
synced 2025-01-21 03:55:00 +00:00
Implement TreeSet#descendingIterator
If need be, this functionality can be sped up by implementing a descending iterator on the tree without copying it into an ArrayList. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
1ed90c38ab
commit
c023bd8654
@ -56,6 +56,12 @@ public class TreeSet<T> extends AbstractSet<T> implements Collection<T> {
|
||||
return new MyIterator<T>(set.first());
|
||||
}
|
||||
|
||||
public Iterator<T> descendingIterator() {
|
||||
ArrayList<T> iterable = new ArrayList<T>(this);
|
||||
Collections.reverse(iterable);
|
||||
return iterable.iterator();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return Collections.toString(this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user