diff --git a/classpath/java/util/NavigableMap.java b/classpath/java/util/NavigableMap.java new file mode 100644 index 0000000000..05136159c6 --- /dev/null +++ b/classpath/java/util/NavigableMap.java @@ -0,0 +1,6 @@ +package java.util; + +public interface NavigableMap extends SortedMap { + Map.Entry firstEntry(); + Map.Entry lastEntry(); +} diff --git a/classpath/java/util/TreeMap.java b/classpath/java/util/TreeMap.java index e7258255cd..3c4de1b141 100644 --- a/classpath/java/util/TreeMap.java +++ b/classpath/java/util/TreeMap.java @@ -14,7 +14,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -public class TreeMap implements SortedMap { +public class TreeMap implements NavigableMap { private final Comparator comparator; private transient TreeSet> set; @@ -50,6 +50,16 @@ public class TreeMap implements SortedMap { return comparator; } + @Override + public Map.Entry firstEntry() { + return set.first(); + } + + @Override + public Map.Entry lastEntry() { + return set.last(); + } + @Override public K firstKey() { return set.first().key;