mirror of
https://github.com/corda/corda.git
synced 2025-01-22 12:28:11 +00:00
implement first() and last() in TreeSet
This commit is contained in:
parent
84bcbbcaa3
commit
a8bb0d074b
@ -42,6 +42,18 @@ public class TreeSet<T> extends AbstractSet<T> implements Collection<T> {
|
||||
}
|
||||
}
|
||||
|
||||
public T first() {
|
||||
if (isEmpty()) throw new NoSuchElementException();
|
||||
|
||||
return set.first().value().value;
|
||||
}
|
||||
|
||||
public T last() {
|
||||
if (isEmpty()) throw new NoSuchElementException();
|
||||
|
||||
return set.last().value().value;
|
||||
}
|
||||
|
||||
public Iterator<T> iterator() {
|
||||
return new MyIterator<T>(set.first());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user