ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/NavigableMap.java
(Generate patch)

Comparing jsr166/src/main/java/util/NavigableMap.java (file contents):
Revision 1.10 by dl, Mon Jul 18 19:32:38 2005 UTC vs.
Revision 1.24 by jsr166, Tue Mar 15 19:47:02 2011 UTC

# Line 1 | Line 1
1   /*
2 < * Written by Doug Lea with assistance from members of JCP JSR-166
3 < * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
2 > * Written by Doug Lea and Josh Bloch with assistance from members of JCP
3 > * JSR-166 Expert Group and released to the public domain, as explained at
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   package java.util;
# Line 9 | Line 9 | package java.util;
9   /**
10   * A {@link SortedMap} extended with navigation methods returning the
11   * closest matches for given search targets. Methods
12 < * <tt>lowerEntry</tt>, <tt>floorEntry</tt>, <tt>ceilingEntry</tt>,
13 < * and <tt>higherEntry</tt> return <tt>Map.Entry</tt> objects
12 > * {@code lowerEntry}, {@code floorEntry}, {@code ceilingEntry},
13 > * and {@code higherEntry} return {@code Map.Entry} objects
14   * associated with keys respectively less than, less than or equal,
15   * greater than or equal, and greater than a given key, returning
16 < * <tt>null</tt> if there is no such key.  Similarly, methods
17 < * <tt>lowerKey</tt>, <tt>floorKey</tt>, <tt>ceilingKey</tt>, and
18 < * <tt>higherKey</tt> return only the associated keys. All of these
16 > * {@code null} if there is no such key.  Similarly, methods
17 > * {@code lowerKey}, {@code floorKey}, {@code ceilingKey}, and
18 > * {@code higherKey} return only the associated keys. All of these
19   * methods are designed for locating, not traversing entries.
20   *
21 < * <p>A <tt>NavigableMap</tt> may be viewed and traversed in either
22 < * ascending or descending key order.  The <tt>Map</tt> methods
23 < * <tt>keySet</tt> and <tt>entrySet</tt> return ascending views, and
24 < * the additional methods <tt>descendingKeySet</tt> and
25 < * <tt>descendingEntrySet</tt> return descending views. The
26 < * performance of ascending traversals is likely to be faster than
27 < * descending traversals.  Notice that it is possible to perform
28 < * subrange traversals in either direction using <tt>navigableSubMap</tt>.
29 < * Methods <tt>navigableSubMap</tt>, <tt>navigableHeadMap</tt>, and
30 < * <tt>navigableTailMap</tt> differ from the similarly named
31 < * <tt>SortedMap</tt> methods only in their declared return types.
32 < * Submaps of any <tt>NavigableMap</tt> must obey
33 < * the <tt>NavigableMap</tt> interface.
21 > * <p>A {@code NavigableMap} may be accessed and traversed in either
22 > * ascending or descending key order.  The {@code descendingMap}
23 > * method returns a view of the map with the senses of all relational
24 > * and directional methods inverted. The performance of ascending
25 > * operations and views is likely to be faster than that of descending
26 > * ones.  Methods {@code subMap}, {@code headMap},
27 > * and {@code tailMap} differ from the like-named {@code
28 > * SortedMap} methods in accepting additional arguments describing
29 > * whether lower and upper bounds are inclusive versus exclusive.
30 > * Submaps of any {@code NavigableMap} must implement the {@code
31 > * NavigableMap} interface.
32   *
33 < * <p>This interface additionally defines methods <tt>firstEntry</tt>,
34 < * <tt>pollFirstEntry</tt>, <tt>lastEntry</tt>, and
35 < * <tt>pollLastEntry</tt> that return and/or remove the least and
36 < * greatest mappings, if any exist, else returning <tt>null</tt>.
33 > * <p>This interface additionally defines methods {@code firstEntry},
34 > * {@code pollFirstEntry}, {@code lastEntry}, and
35 > * {@code pollLastEntry} that return and/or remove the least and
36 > * greatest mappings, if any exist, else returning {@code null}.
37   *
38 < * <p> Implementations of entry-returning methods are expected to
39 < * return <tt>Map.Entry</tt> pairs representing snapshots of mappings
38 > * <p>Implementations of entry-returning methods are expected to
39 > * return {@code Map.Entry} pairs representing snapshots of mappings
40   * at the time they were produced, and thus generally do <em>not</em>
41 < * support the optional <tt>Entry.setValue</tt> method. Note however
41 > * support the optional {@code Entry.setValue} method. Note however
42   * that it is possible to change mappings in the associated map using
43 < * method <tt>put</tt>.
43 > * method {@code put}.
44 > *
45 > * <p>Methods
46 > * {@link #subMap(Object, Object) subMap(K, K)},
47 > * {@link #headMap(Object) headMap(K)}, and
48 > * {@link #tailMap(Object) tailMap(K)}
49 > * are specified to return {@code SortedMap} to allow existing
50 > * implementations of {@code SortedMap} to be compatibly retrofitted to
51 > * implement {@code NavigableMap}, but extensions and implementations
52 > * of this interface are encouraged to override these methods to return
53 > * {@code NavigableMap}.  Similarly,
54 > * {@link #keySet()} can be overriden to return {@code NavigableSet}.
55   *
56   * <p>This interface is a member of the
57 < * <a href="{@docRoot}/../guide/collections/index.html">
57 > * <a href="{@docRoot}/../technotes/guides/collections/index.html">
58   * Java Collections Framework</a>.
59   *
60   * @author Doug Lea
61 + * @author Josh Bloch
62   * @param <K> the type of keys maintained by this map
63   * @param <V> the type of mapped values
64   * @since 1.6
# Line 56 | Line 66 | package java.util;
66   public interface NavigableMap<K,V> extends SortedMap<K,V> {
67      /**
68       * Returns a key-value mapping associated with the greatest key
69 <     * strictly less than the given key, or <tt>null</tt> if there is
69 >     * strictly less than the given key, or {@code null} if there is
70       * no such key.
71       *
72       * @param key the key
73 <     * @return an entry with the greatest key less than <tt>key</tt>,
74 <     *         or <tt>null</tt> if there is no such key
73 >     * @return an entry with the greatest key less than {@code key},
74 >     *         or {@code null} if there is no such key
75       * @throws ClassCastException if the specified key cannot be compared
76       *         with the keys currently in the map
77       * @throws NullPointerException if the specified key is null
# Line 71 | Line 81 | public interface NavigableMap<K,V> exten
81  
82      /**
83       * Returns the greatest key strictly less than the given key, or
84 <     * <tt>null</tt> if there is no such key.
84 >     * {@code null} if there is no such key.
85       *
86       * @param key the key
87 <     * @return the greatest key less than <tt>key</tt>,
88 <     *         or <tt>null</tt> if there is no such key
87 >     * @return the greatest key less than {@code key},
88 >     *         or {@code null} if there is no such key
89       * @throws ClassCastException if the specified key cannot be compared
90       *         with the keys currently in the map
91       * @throws NullPointerException if the specified key is null
# Line 85 | Line 95 | public interface NavigableMap<K,V> exten
95  
96      /**
97       * Returns a key-value mapping associated with the greatest key
98 <     * less than or equal to the given key, or <tt>null</tt> if there
98 >     * less than or equal to the given key, or {@code null} if there
99       * is no such key.
100       *
101       * @param key the key
102       * @return an entry with the greatest key less than or equal to
103 <     *         <tt>key</tt>, or <tt>null</tt> if there is no such key
103 >     *         {@code key}, or {@code null} if there is no such key
104       * @throws ClassCastException if the specified key cannot be compared
105       *         with the keys currently in the map
106       * @throws NullPointerException if the specified key is null
# Line 100 | Line 110 | public interface NavigableMap<K,V> exten
110  
111      /**
112       * Returns the greatest key less than or equal to the given key,
113 <     * or <tt>null</tt> if there is no such key.
113 >     * or {@code null} if there is no such key.
114       *
115       * @param key the key
116 <     * @return the greatest key less than or equal to <tt>key</tt>,
117 <     *         or <tt>null</tt> if there is no such key
116 >     * @return the greatest key less than or equal to {@code key},
117 >     *         or {@code null} if there is no such key
118       * @throws ClassCastException if the specified key cannot be compared
119       *         with the keys currently in the map
120       * @throws NullPointerException if the specified key is null
# Line 114 | Line 124 | public interface NavigableMap<K,V> exten
124  
125      /**
126       * Returns a key-value mapping associated with the least key
127 <     * greater than or equal to the given key, or <tt>null</tt> if
127 >     * greater than or equal to the given key, or {@code null} if
128       * there is no such key.
129       *
130       * @param key the key
131       * @return an entry with the least key greater than or equal to
132 <     *         <tt>key</tt>, or <tt>null</tt> if there is no such key
132 >     *         {@code key}, or {@code null} if there is no such key
133       * @throws ClassCastException if the specified key cannot be compared
134       *         with the keys currently in the map
135       * @throws NullPointerException if the specified key is null
# Line 129 | Line 139 | public interface NavigableMap<K,V> exten
139  
140      /**
141       * Returns the least key greater than or equal to the given key,
142 <     * or <tt>null</tt> if there is no such key.
142 >     * or {@code null} if there is no such key.
143       *
144       * @param key the key
145 <     * @return the least key greater than or equal to <tt>key</tt>,
146 <     *         or <tt>null</tt> if there is no such key
145 >     * @return the least key greater than or equal to {@code key},
146 >     *         or {@code null} if there is no such key
147       * @throws ClassCastException if the specified key cannot be compared
148       *         with the keys currently in the map
149       * @throws NullPointerException if the specified key is null
# Line 143 | Line 153 | public interface NavigableMap<K,V> exten
153  
154      /**
155       * Returns a key-value mapping associated with the least key
156 <     * strictly greater than the given key, or <tt>null</tt> if there
156 >     * strictly greater than the given key, or {@code null} if there
157       * is no such key.
158       *
159       * @param key the key
160 <     * @return an entry with the least key greater than <tt>key</tt>,
161 <     *         or <tt>null</tt> if there is no such key
160 >     * @return an entry with the least key greater than {@code key},
161 >     *         or {@code null} if there is no such key
162       * @throws ClassCastException if the specified key cannot be compared
163       *         with the keys currently in the map
164       * @throws NullPointerException if the specified key is null
# Line 158 | Line 168 | public interface NavigableMap<K,V> exten
168  
169      /**
170       * Returns the least key strictly greater than the given key, or
171 <     * <tt>null</tt> if there is no such key.
171 >     * {@code null} if there is no such key.
172       *
173       * @param key the key
174 <     * @return the least key greater than <tt>key</tt>,
175 <     *         or <tt>null</tt> if there is no such key
174 >     * @return the least key greater than {@code key},
175 >     *         or {@code null} if there is no such key
176       * @throws ClassCastException if the specified key cannot be compared
177       *         with the keys currently in the map
178       * @throws NullPointerException if the specified key is null
# Line 172 | Line 182 | public interface NavigableMap<K,V> exten
182  
183      /**
184       * Returns a key-value mapping associated with the least
185 <     * key in this map, or <tt>null</tt> if the map is empty.
185 >     * key in this map, or {@code null} if the map is empty.
186       *
187       * @return an entry with the least key,
188 <     *         or <tt>null</tt> if this map is empty
188 >     *         or {@code null} if this map is empty
189       */
190      Map.Entry<K,V> firstEntry();
191  
192      /**
193       * Returns a key-value mapping associated with the greatest
194 <     * key in this map, or <tt>null</tt> if the map is empty.
194 >     * key in this map, or {@code null} if the map is empty.
195       *
196       * @return an entry with the greatest key,
197 <     *         or <tt>null</tt> if this map is empty
197 >     *         or {@code null} if this map is empty
198       */
199      Map.Entry<K,V> lastEntry();
200  
201      /**
202       * Removes and returns a key-value mapping associated with
203 <     * the least key in this map, or <tt>null</tt> if the map is empty.
203 >     * the least key in this map, or {@code null} if the map is empty.
204       *
205       * @return the removed first entry of this map,
206 <     *         or <tt>null</tt> if this map is empty
206 >     *         or {@code null} if this map is empty
207       */
208      Map.Entry<K,V> pollFirstEntry();
209  
210      /**
211       * Removes and returns a key-value mapping associated with
212 <     * the greatest key in this map, or <tt>null</tt> if the map is empty.
212 >     * the greatest key in this map, or {@code null} if the map is empty.
213       *
214       * @return the removed last entry of this map,
215 <     *         or <tt>null</tt> if this map is empty
215 >     *         or {@code null} if this map is empty
216       */
217      Map.Entry<K,V> pollLastEntry();
218  
219      /**
220 <     * Returns a {@link Set} view of the keys contained in this map.
220 >     * Returns a reverse order view of the mappings contained in this map.
221 >     * The descending map is backed by this map, so changes to the map are
222 >     * reflected in the descending map, and vice-versa.  If either map is
223 >     * modified while an iteration over a collection view of either map
224 >     * is in progress (except through the iterator's own {@code remove}
225 >     * operation), the results of the iteration are undefined.
226 >     *
227 >     * <p>The returned map has an ordering equivalent to
228 >     * <tt>{@link Collections#reverseOrder(Comparator) Collections.reverseOrder}(comparator())</tt>.
229 >     * The expression {@code m.descendingMap().descendingMap()} returns a
230 >     * view of {@code m} essentially equivalent to {@code m}.
231 >     *
232 >     * @return a reverse order view of this map
233 >     */
234 >    NavigableMap<K,V> descendingMap();
235 >
236 >    /**
237 >     * Returns a {@link NavigableSet} view of the keys contained in this map.
238 >     * The set's iterator returns the keys in ascending order.
239 >     * The set is backed by the map, so changes to the map are reflected in
240 >     * the set, and vice-versa.  If the map is modified while an iteration
241 >     * over the set is in progress (except through the iterator's own {@code
242 >     * remove} operation), the results of the iteration are undefined.  The
243 >     * set supports element removal, which removes the corresponding mapping
244 >     * from the map, via the {@code Iterator.remove}, {@code Set.remove},
245 >     * {@code removeAll}, {@code retainAll}, and {@code clear} operations.
246 >     * It does not support the {@code add} or {@code addAll} operations.
247 >     *
248 >     * @return a navigable set view of the keys in this map
249 >     */
250 >    NavigableSet<K> navigableKeySet();
251 >
252 >    /**
253 >     * Returns a reverse order {@link NavigableSet} view of the keys contained in this map.
254       * The set's iterator returns the keys in descending order.
255 <     * The set is backed by the map, so changes to the map are
256 <     * reflected in the set, and vice-versa.  If the map is modified
257 <     * while an iteration over the set is in progress (except through
258 <     * the iterator's own <tt>remove</tt> operation), the results of
259 <     * the iteration are undefined.  The set supports element removal,
260 <     * which removes the corresponding mapping from the map, via the
261 <     * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
262 <     * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
220 <     * operations.  It does not support the <tt>add</tt> or <tt>addAll</tt>
221 <     * operations.
222 <     *
223 <     * @return a set view of the keys contained in this map, sorted in
224 <     *         descending order
225 <     */
226 <    Set<K> descendingKeySet();
227 <
228 <    /**
229 <     * Returns a {@link Set} view of the mappings contained in this map.
230 <     * The set's iterator returns the entries in descending key order.
231 <     * The set is backed by the map, so changes to the map are
232 <     * reflected in the set, and vice-versa.  If the map is modified
233 <     * while an iteration over the set is in progress (except through
234 <     * the iterator's own <tt>remove</tt> operation, or through the
235 <     * <tt>setValue</tt> operation on a map entry returned by the
236 <     * iterator) the results of the iteration are undefined.  The set
237 <     * supports element removal, which removes the corresponding
238 <     * mapping from the map, via the <tt>Iterator.remove</tt>,
239 <     * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and
240 <     * <tt>clear</tt> operations.  It does not support the
241 <     * <tt>add</tt> or <tt>addAll</tt> operations.
255 >     * The set is backed by the map, so changes to the map are reflected in
256 >     * the set, and vice-versa.  If the map is modified while an iteration
257 >     * over the set is in progress (except through the iterator's own {@code
258 >     * remove} operation), the results of the iteration are undefined.  The
259 >     * set supports element removal, which removes the corresponding mapping
260 >     * from the map, via the {@code Iterator.remove}, {@code Set.remove},
261 >     * {@code removeAll}, {@code retainAll}, and {@code clear} operations.
262 >     * It does not support the {@code add} or {@code addAll} operations.
263       *
264 <     * @return a set view of the mappings contained in this map,
244 <     *         sorted in descending key order
264 >     * @return a reverse order navigable set view of the keys in this map
265       */
266 <    Set<Map.Entry<K, V>> descendingEntrySet();
266 >    NavigableSet<K> descendingKeySet();
267  
268      /**
269       * Returns a view of the portion of this map whose keys range from
270 <     * <tt>fromKey</tt>, inclusive, to <tt>toKey</tt>, exclusive.  (If
271 <     * <tt>fromKey</tt> and <tt>toKey</tt> are equal, the returned map
272 <     * is empty.)  The returned map is backed by this map, so changes
273 <     * in the returned map are reflected in this map, and vice-versa.
274 <     * The returned map supports all optional map operations that this
275 <     * map supports.
256 <     *
257 <     * <p>The returned map will throw an <tt>IllegalArgumentException</tt>
258 <     * on an attempt to insert a key outside its range.
270 >     * {@code fromKey} to {@code toKey}.  If {@code fromKey} and
271 >     * {@code toKey} are equal, the returned map is empty unless
272 >     * {@code fromExclusive} and {@code toExclusive} are both true.  The
273 >     * returned map is backed by this map, so changes in the returned map are
274 >     * reflected in this map, and vice-versa.  The returned map supports all
275 >     * optional map operations that this map supports.
276       *
277 <     * @param fromKey low endpoint (inclusive) of the keys in the returned map
278 <     * @param toKey high endpoint (exclusive) of the keys in the returned map
277 >     * <p>The returned map will throw an {@code IllegalArgumentException}
278 >     * on an attempt to insert a key outside of its range, or to construct a
279 >     * submap either of whose endpoints lie outside its range.
280 >     *
281 >     * @param fromKey low endpoint of the keys in the returned map
282 >     * @param fromInclusive {@code true} if the low endpoint
283 >     *        is to be included in the returned view
284 >     * @param toKey high endpoint of the keys in the returned map
285 >     * @param toInclusive {@code true} if the high endpoint
286 >     *        is to be included in the returned view
287       * @return a view of the portion of this map whose keys range from
288 <     *         <tt>fromKey</tt>, inclusive, to <tt>toKey</tt>, exclusive
289 <     * @throws ClassCastException if <tt>fromKey</tt> and <tt>toKey</tt>
288 >     *         {@code fromKey} to {@code toKey}
289 >     * @throws ClassCastException if {@code fromKey} and {@code toKey}
290       *         cannot be compared to one another using this map's comparator
291       *         (or, if the map has no comparator, using natural ordering).
292       *         Implementations may, but are not required to, throw this
293 <     *         exception if <tt>fromKey</tt> or <tt>toKey</tt>
293 >     *         exception if {@code fromKey} or {@code toKey}
294       *         cannot be compared to keys currently in the map.
295 <     * @throws NullPointerException if <tt>fromKey</tt> or <tt>toKey</tt>
295 >     * @throws NullPointerException if {@code fromKey} or {@code toKey}
296       *         is null and this map does not permit null keys
297 <     * @throws IllegalArgumentException if <tt>fromKey</tt> is greater than
298 <     *         <tt>toKey</tt>; or if this map itself has a restricted
299 <     *         range, and <tt>fromKey</tt> or <tt>toKey</tt> lies
297 >     * @throws IllegalArgumentException if {@code fromKey} is greater than
298 >     *         {@code toKey}; or if this map itself has a restricted
299 >     *         range, and {@code fromKey} or {@code toKey} lies
300       *         outside the bounds of the range
301       */
302 <    NavigableMap<K,V> navigableSubMap(K fromKey, K toKey);
302 >    NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive,
303 >                             K toKey,   boolean toInclusive);
304  
305      /**
306 <     * Returns a view of the portion of this map whose keys are
307 <     * strictly less than <tt>toKey</tt>.  The returned map is backed
308 <     * by this map, so changes in the returned map are reflected in
309 <     * this map, and vice-versa.  The returned map supports all
310 <     * optional map operations that this map supports.
306 >     * Returns a view of the portion of this map whose keys are less than (or
307 >     * equal to, if {@code inclusive} is true) {@code toKey}.  The returned
308 >     * map is backed by this map, so changes in the returned map are reflected
309 >     * in this map, and vice-versa.  The returned map supports all optional
310 >     * map operations that this map supports.
311       *
312 <     * <p>The returned map will throw an <tt>IllegalArgumentException</tt>
312 >     * <p>The returned map will throw an {@code IllegalArgumentException}
313       * on an attempt to insert a key outside its range.
314       *
315 <     * @param toKey high endpoint (exclusive) of the keys in the returned map
316 <     * @return a view of the portion of this map whose keys are strictly
317 <     *         less than <tt>toKey</tt>
318 <     * @throws ClassCastException if <tt>toKey</tt> is not compatible
315 >     * @param toKey high endpoint of the keys in the returned map
316 >     * @param inclusive {@code true} if the high endpoint
317 >     *        is to be included in the returned view
318 >     * @return a view of the portion of this map whose keys are less than
319 >     *         (or equal to, if {@code inclusive} is true) {@code toKey}
320 >     * @throws ClassCastException if {@code toKey} is not compatible
321       *         with this map's comparator (or, if the map has no comparator,
322 <     *         if <tt>toKey</tt> does not implement {@link Comparable}).
322 >     *         if {@code toKey} does not implement {@link Comparable}).
323       *         Implementations may, but are not required to, throw this
324 <     *         exception if <tt>toKey</tt> cannot be compared to keys
324 >     *         exception if {@code toKey} cannot be compared to keys
325       *         currently in the map.
326 <     * @throws NullPointerException if <tt>toKey</tt> is null
326 >     * @throws NullPointerException if {@code toKey} is null
327       *         and this map does not permit null keys
328       * @throws IllegalArgumentException if this map itself has a
329 <     *         restricted range, and <tt>toKey</tt> lies outside the
329 >     *         restricted range, and {@code toKey} lies outside the
330       *         bounds of the range
331       */
332 <    NavigableMap<K,V> navigableHeadMap(K toKey);
332 >    NavigableMap<K,V> headMap(K toKey, boolean inclusive);
333  
334      /**
335 <     * Returns a view of the portion of this map whose keys are
336 <     * greater than or equal to <tt>fromKey</tt>.  The returned map is
337 <     * backed by this map, so changes in the returned map are
338 <     * reflected in this map, and vice-versa.  The returned map
339 <     * supports all optional map operations that this map supports.
335 >     * Returns a view of the portion of this map whose keys are greater than (or
336 >     * equal to, if {@code inclusive} is true) {@code fromKey}.  The returned
337 >     * map is backed by this map, so changes in the returned map are reflected
338 >     * in this map, and vice-versa.  The returned map supports all optional
339 >     * map operations that this map supports.
340       *
341 <     * <p>The returned map will throw an <tt>IllegalArgumentException</tt>
341 >     * <p>The returned map will throw an {@code IllegalArgumentException}
342       * on an attempt to insert a key outside its range.
343       *
344 <     * @param fromKey low endpoint (inclusive) of the keys in the returned map
345 <     * @return a view of the portion of this map whose keys are greater
346 <     *         than or equal to <tt>fromKey</tt>
347 <     * @throws ClassCastException if <tt>fromKey</tt> is not compatible
344 >     * @param fromKey low endpoint of the keys in the returned map
345 >     * @param inclusive {@code true} if the low endpoint
346 >     *        is to be included in the returned view
347 >     * @return a view of the portion of this map whose keys are greater than
348 >     *         (or equal to, if {@code inclusive} is true) {@code fromKey}
349 >     * @throws ClassCastException if {@code fromKey} is not compatible
350       *         with this map's comparator (or, if the map has no comparator,
351 <     *         if <tt>fromKey</tt> does not implement {@link Comparable}).
351 >     *         if {@code fromKey} does not implement {@link Comparable}).
352       *         Implementations may, but are not required to, throw this
353 <     *         exception if <tt>fromKey</tt> cannot be compared to keys
353 >     *         exception if {@code fromKey} cannot be compared to keys
354       *         currently in the map.
355 <     * @throws NullPointerException if <tt>fromKey</tt> is null
355 >     * @throws NullPointerException if {@code fromKey} is null
356       *         and this map does not permit null keys
357       * @throws IllegalArgumentException if this map itself has a
358 <     *         restricted range, and <tt>fromKey</tt> lies outside the
358 >     *         restricted range, and {@code fromKey} lies outside the
359       *         bounds of the range
360       */
361 <    NavigableMap<K,V> navigableTailMap(K fromKey);
361 >    NavigableMap<K,V> tailMap(K fromKey, boolean inclusive);
362 >
363 >    /**
364 >     * {@inheritDoc}
365 >     *
366 >     * <p>Equivalent to {@code subMap(fromKey, true, toKey, false)}.
367 >     *
368 >     * @throws ClassCastException       {@inheritDoc}
369 >     * @throws NullPointerException     {@inheritDoc}
370 >     * @throws IllegalArgumentException {@inheritDoc}
371 >     */
372 >    SortedMap<K,V> subMap(K fromKey, K toKey);
373 >
374 >    /**
375 >     * {@inheritDoc}
376 >     *
377 >     * <p>Equivalent to {@code headMap(toKey, false)}.
378 >     *
379 >     * @throws ClassCastException       {@inheritDoc}
380 >     * @throws NullPointerException     {@inheritDoc}
381 >     * @throws IllegalArgumentException {@inheritDoc}
382 >     */
383 >    SortedMap<K,V> headMap(K toKey);
384 >
385 >    /**
386 >     * {@inheritDoc}
387 >     *
388 >     * <p>Equivalent to {@code tailMap(fromKey, true)}.
389 >     *
390 >     * @throws ClassCastException       {@inheritDoc}
391 >     * @throws NullPointerException     {@inheritDoc}
392 >     * @throws IllegalArgumentException {@inheritDoc}
393 >     */
394 >    SortedMap<K,V> tailMap(K fromKey);
395   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines