--- jsr166/src/main/java/util/NavigableMap.java 2006/04/19 15:07:14 1.14 +++ jsr166/src/main/java/util/NavigableMap.java 2006/04/21 23:11:14 1.21 @@ -23,8 +23,8 @@ package java.util; * method returns a view of the map with the senses of all relational * and directional methods inverted. The performance of ascending * operations and views is likely to be faster than that of descending - * ones. Methods {@code navigableSubMap}, {@code navigableHeadMap}, - * and {@code navigableTailMap} differ from the similarly named {@code + * ones. Methods {@code subMap}, {@code headMap}, + * and {@code tailMap} differ from the like-named {@code * SortedMap} methods in accepting additional arguments describing * whether lower and upper bounds are inclusive versus exclusive. * Submaps of any {@code NavigableMap} must implement the {@code @@ -208,13 +208,13 @@ public interface NavigableMap exten /** * Returns a {@link NavigableMap} view of the mappings contained in this * map in descending order. The descending map is backed by this map, so - * changes to the map are reflected in the descending set, and vice-versa. + * changes to the map are reflected in the descending map, and vice-versa. * If either map is modified while an iteration over a collection view of * the other map is in progress (except through the iterator's own * {@code remove} operation), the results of the iteration are undefined. * * @return a navigable map view of the mappings contained in this map, - * sorted in descending order + * sorted in descending order */ NavigableMap descendingMap(); @@ -226,7 +226,7 @@ public interface NavigableMap exten * {@code remove} operation), the results of the iteration are undefined. * The set supports element removal, which removes the corresponding * mapping from the map, via the {@code Iterator.remove}, - * {@code Set.remove}, {@code removeAll} {@code retainAll}, and + * {@code Set.remove}, {@code removeAll}, {@code retainAll}, and * {@code clear} operations. It does not support the {@code add} or * {@code addAll} operations. * @@ -240,12 +240,12 @@ public interface NavigableMap exten * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through - * the iterator's own remove operation), the results of + * the iterator's own {@code remove} operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the - * Iterator.remove, Set.remove, - * removeAll, retainAll, and clear - * operations. It does not support the add or addAll + * {@code Iterator.remove}, {@code Set.remove}, + * {@code removeAll}, {@code retainAll}, and {@code clear} + * operations. It does not support the {@code add} or {@code addAll} * operations. * * @return a set view of the keys contained in this map, sorted in @@ -267,11 +267,11 @@ public interface NavigableMap exten * submap either of whose endpoints lie outside its range. * * @param fromKey low endpoint of the keys in the returned map - * @param fromInclusive true if the low endpoint ({@code fromKey}) is - * to be included in the the returned view + * @param fromInclusive {@code true} if the low endpoint + * is to be included in the returned view * @param toKey high endpoint of the keys in the returned map - * @param toInclusive true if the high endpoint ({@code toKey}) is - * to be included in the the returned view + * @param toInclusive {@code true} if the high endpoint + * is to be included in the returned view * @return a view of the portion of this map whose keys range from * {@code fromKey} to {@code toKey} * @throws ClassCastException if {@code fromKey} and {@code toKey} @@ -287,8 +287,8 @@ public interface NavigableMap exten * range, and {@code fromKey} or {@code toKey} lies * outside the bounds of the range */ - NavigableMap navigableSubMap(K fromKey, boolean fromInclusive, - K toKey, boolean toInclusive); + NavigableMap subMap(K fromKey, boolean fromInclusive, + K toKey, boolean toInclusive); /** * Returns a view of the portion of this map whose keys are less than (or @@ -301,8 +301,8 @@ public interface NavigableMap exten * on an attempt to insert a key outside its range. * * @param toKey high endpoint of the keys in the returned map - * @param inclusive true if the high endpoint ({@code toKey}) is - * to be included in the the returned view + * @param inclusive {@code true} if the high endpoint + * is to be included in the returned view * @return a view of the portion of this map whose keys are less than * (or equal to, if {@code inclusive} is true) {@code toKey} * @throws ClassCastException if {@code toKey} is not compatible @@ -317,7 +317,7 @@ public interface NavigableMap exten * restricted range, and {@code toKey} lies outside the * bounds of the range */ - NavigableMap navigableHeadMap(K toKey, boolean inclusive); + NavigableMap headMap(K toKey, boolean inclusive); /** * Returns a view of the portion of this map whose keys are greater than (or @@ -330,8 +330,8 @@ public interface NavigableMap exten * on an attempt to insert a key outside its range. * * @param fromKey low endpoint of the keys in the returned map - * @param inclusive true if the low endpoint ({@code fromKey}) is - * to be included in the the returned view + * @param inclusive {@code true} if the low endpoint + * is to be included in the returned view * @return a view of the portion of this map whose keys are greater than * (or equal to, if {@code inclusive} is true) {@code fromKey} * @throws ClassCastException if {@code fromKey} is not compatible @@ -346,5 +346,41 @@ public interface NavigableMap exten * restricted range, and {@code fromKey} lies outside the * bounds of the range */ - NavigableMap navigableTailMap(K fromKey, boolean inclusive); + NavigableMap tailMap(K fromKey, boolean inclusive); + + /** + * Equivalent to {@code subMap(fromKey, true, toKey, false)} + * but with a return type conforming to the {@code SortedMap} interface. + * + *

{@inheritDoc} + * + * @throws ClassCastException {@inheritDoc} + * @throws NullPointerException {@inheritDoc} + * @throws IllegalArgumentException {@inheritDoc} + */ + SortedMap subMap(K fromKey, K toKey); + + /** + * Equivalent to {@code headMap(toKey, false)} + * but with a return type conforming to the {@code SortedMap} interface. + * + *

{@inheritDoc} + * + * @throws ClassCastException {@inheritDoc} + * @throws NullPointerException {@inheritDoc} + * @throws IllegalArgumentException {@inheritDoc} + */ + SortedMap headMap(K toKey); + + /** + * Equivalent to {@code tailMap(fromKey, true)} + * but with a return type conforming to the {@code SortedMap} interface. + * + *

{@inheritDoc} + * + * @throws ClassCastException {@inheritDoc} + * @throws NullPointerException {@inheritDoc} + * @throws IllegalArgumentException {@inheritDoc} + */ + SortedMap tailMap(K fromKey); }