mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
Merge pull request #364 from dicej/navigable-map
add minimal NavigableMap interface
This commit is contained in:
commit
d037a69cd3
6
classpath/java/util/NavigableMap.java
Normal file
6
classpath/java/util/NavigableMap.java
Normal file
@ -0,0 +1,6 @@
|
||||
package java.util;
|
||||
|
||||
public interface NavigableMap<K, V> extends SortedMap<K, V> {
|
||||
Map.Entry<K,V> firstEntry();
|
||||
Map.Entry<K,V> lastEntry();
|
||||
}
|
@ -14,7 +14,7 @@ import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
public class TreeMap<K,V> implements SortedMap<K,V> {
|
||||
public class TreeMap<K,V> implements NavigableMap<K,V> {
|
||||
private final Comparator<K> comparator;
|
||||
private transient TreeSet<MyEntry<K,V>> set;
|
||||
|
||||
@ -50,6 +50,16 @@ public class TreeMap<K,V> implements SortedMap<K,V> {
|
||||
return comparator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map.Entry<K,V> firstEntry() {
|
||||
return set.first();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map.Entry<K,V> lastEntry() {
|
||||
return set.last();
|
||||
}
|
||||
|
||||
@Override
|
||||
public K firstKey() {
|
||||
return set.first().key;
|
||||
|
Loading…
Reference in New Issue
Block a user