--- jsr166/src/main/java/util/NavigableMap.java 2004/12/28 12:14:07 1.1 +++ jsr166/src/main/java/util/NavigableMap.java 2005/05/02 22:34:56 1.6 @@ -25,8 +25,12 @@ package java.util; * descendingEntrySet return descending views. The * performance of ascending traversals is likely to be faster than * descending traversals. Notice that it is possible to perform - * subrannge traversals in either direction using SubMap. - * + * subrange traversals in either direction using navigableSubMap. + * Methods navigableSubMap, navigableHeadMap, and + * navigableTailMap differ from the similarly named + * SortedMap methods only in that the returned maps + * are guaranteed to obey the NavigableMap interface. + * *

This interface additionally defines methods firstEntry, * pollFirstEntry, lastEntry, and * pollLastEntry that return and/or remove the least and @@ -41,14 +45,15 @@ package java.util; * * @author Doug Lea * @param the type of keys maintained by this map - * @param the type of mapped values + * @param the type of mapped values + * @since 1.6 */ public interface NavigableMap extends SortedMap { /** * Returns a key-value mapping associated with the least key * greater than or equal to the given key, or null if there is - * no such entry. - * + * no such entry. + * * @param key the key. * @return an Entry associated with ceiling of given key, or null * if there is no such Entry. @@ -57,12 +62,12 @@ public interface NavigableMap exten * @throws NullPointerException if key is null and this map * does not support null keys. */ - public Map.Entry ceilingEntry(K key); + Map.Entry ceilingEntry(K key); /** * Returns least key greater than or equal to the given key, or * null if there is no such key. - * + * * @param key the key. * @return the ceiling key, or null * if there is no such key. @@ -71,13 +76,13 @@ public interface NavigableMap exten * @throws NullPointerException if key is null and this map * does not support null keys. */ - public K ceilingKey(K key); + K ceilingKey(K key); /** * Returns a key-value mapping associated with the greatest * key strictly less than the given key, or null if there is no - * such entry. - * + * such entry. + * * @param key the key. * @return an Entry with greatest key less than the given * key, or null if there is no such Entry. @@ -86,12 +91,12 @@ public interface NavigableMap exten * @throws NullPointerException if key is null and this map * does not support null keys. */ - public Map.Entry lowerEntry(K key); + Map.Entry lowerEntry(K key); /** * Returns the greatest key strictly less than the given key, or * null if there is no such key. - * + * * @param key the key. * @return the greatest key less than the given * key, or null if there is no such key. @@ -100,13 +105,13 @@ public interface NavigableMap exten * @throws NullPointerException if key is null and this map * does not support null keys. */ - public K lowerKey(K key); + K lowerKey(K key); /** * Returns a key-value mapping associated with the greatest key * less than or equal to the given key, or null if there * is no such entry. - * + * * @param key the key. * @return an Entry associated with floor of given key, or null * if there is no such Entry. @@ -115,13 +120,13 @@ public interface NavigableMap exten * @throws NullPointerException if key is null and this map * does not support null keys. */ - public Map.Entry floorEntry(K key); + Map.Entry floorEntry(K key); /** * Returns the greatest key * less than or equal to the given key, or null if there * is no such key. - * + * * @param key the key. * @return the floor of given key, or null if there is no * such key. @@ -130,13 +135,13 @@ public interface NavigableMap exten * @throws NullPointerException if key is null and this map * does not support null keys. */ - public K floorKey(K key); + K floorKey(K key); /** * Returns a key-value mapping associated with the least key * strictly greater than the given key, or null if there * is no such entry. - * + * * @param key the key. * @return an Entry with least key greater than the given key, or * null if there is no such Entry. @@ -145,12 +150,12 @@ public interface NavigableMap exten * @throws NullPointerException if key is null and this map * does not support null keys. */ - public Map.Entry higherEntry(K key); + Map.Entry higherEntry(K key); /** * Returns the least key strictly greater than the given key, or * null if there is no such key. - * + * * @param key the key. * @return the least key greater than the given key, or * null if there is no such key. @@ -159,43 +164,43 @@ public interface NavigableMap exten * @throws NullPointerException if key is null and this map * does not support null keys. */ - public K higherKey(K key); + K higherKey(K key); /** * Returns a key-value mapping associated with the least * key in this map, or null if the map is empty. - * - * @return an Entry with least key, or null + * + * @return an Entry with least key, or null * if the map is empty. */ - public Map.Entry firstEntry(); + Map.Entry firstEntry(); /** * Returns a key-value mapping associated with the greatest * key in this map, or null if the map is empty. - * + * * @return an Entry with greatest key, or null * if the map is empty. */ - public Map.Entry lastEntry(); + Map.Entry lastEntry(); /** * Removes and returns a key-value mapping associated with * the least key in this map, or null if the map is empty. - * + * * @return the removed first entry of this map, or null * if the map is empty. */ - public Map.Entry pollFirstEntry(); + Map.Entry pollFirstEntry(); /** * Removes and returns a key-value mapping associated with * the greatest key in this map, or null if the map is empty. - * + * * @return the removed last entry of this map, or null * if the map is empty. */ - public Map.Entry pollLastEntry(); + Map.Entry pollLastEntry(); /** * Returns a set view of the keys contained in this map, in @@ -237,10 +242,11 @@ public interface NavigableMap exten /** * Returns a view of the portion of this map whose keys range from * fromKey, inclusive, to toKey, exclusive. (If - * fromKey and toKey are equal, the returned sorted map - * is empty.) The returned sorted map is backed by this map, so changes - * in the returned sorted map are reflected in this map, and vice-versa. - + * fromKey and toKey are equal, the returned + * navigable map is empty.) The returned navigable map is backed + * by this map, so changes in the returned navigable map are + * reflected in this map, and vice-versa. + * * @param fromKey low endpoint (inclusive) of the subMap. * @param toKey high endpoint (exclusive) of the subMap. * @@ -257,13 +263,13 @@ public interface NavigableMap exten * toKey is null and this map does not support * null keys. */ - public NavigableMap subMap(K fromKey, K toKey); + NavigableMap navigableSubMap(K fromKey, K toKey); /** * Returns a view of the portion of this map whose keys are strictly less - * than toKey. The returned sorted map is backed by this map, so - * changes in the returned sorted map are reflected in this map, and - * vice-versa. + * than toKey. The returned navigable map is backed by this map, so + * changes in the returned navigable map are reflected in this map, and + * vice-versa. * @param toKey high endpoint (exclusive) of the headMap. * @return a view of the portion of this map whose keys are strictly * less than toKey. @@ -274,12 +280,12 @@ public interface NavigableMap exten * @throws NullPointerException if toKey is null * and this map does not support null keys. */ - public NavigableMap headMap(K toKey); + NavigableMap navigableHeadMap(K toKey); /** * Returns a view of the portion of this map whose keys are - * greater than or equal to fromKey. The returned sorted - * map is backed by this map, so changes in the returned sorted + * greater than or equal to fromKey. The returned navigable + * map is backed by this map, so changes in the returned navigable * map are reflected in this map, and vice-versa. * @param fromKey low endpoint (inclusive) of the tailMap. * @return a view of the portion of this map whose keys are greater @@ -290,5 +296,5 @@ public interface NavigableMap exten * @throws NullPointerException if fromKey is null * and this map does not support null keys. */ - public NavigableMap tailMap(K fromKey); + NavigableMap navigableTailMap(K fromKey); }