[cvs] / jsr166 / src / main / java / util / NavigableMap.java Repository:
ViewVC logotype

Diff of /jsr166/src/main/java/util/NavigableMap.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21, Fri Apr 21 23:11:14 2006 UTC revision 1.22, Tue May 2 19:55:15 2006 UTC
# Line 42  Line 42 
42   * that it is possible to change mappings in the associated map using   * that it is possible to change mappings in the associated map using
43   * method {@code put}.   * 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   * <p>This interface is a member of the
57   * <a href="{@docRoot}/../guide/collections/index.html">   * <a href="{@docRoot}/../technotes/guides/collections/index.html">
58   * Java Collections Framework</a>.   * Java Collections Framework</a>.
59   *   *
60   * @author Doug Lea   * @author Doug Lea
# Line 206  Line 217 
217      Map.Entry<K,V> pollLastEntry();      Map.Entry<K,V> pollLastEntry();
218    
219      /**      /**
220       * Returns a {@link NavigableMap} view of the mappings contained in this       * Returns a reverse order view of the mappings contained in this map.
221       * map in descending order.  The descending map is backed by this map, so       * The descending map is backed by this map, so changes to the map are
222       * changes to the map are reflected in the descending map, and vice-versa.       * reflected in the descending map, and vice-versa.  If either map is
223       * If either map is modified while an iteration over a collection view of       * modified while an iteration over a collection view of either map
224       * the other map is in progress (except through the iterator's own       * is in progress (except through the iterator's own {@code remove}
225       * {@code remove} operation), the results of the iteration are undefined.       * 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 navigable map view of the mappings contained in this map,       * @return a reverse order view of this map
      *         sorted in descending order  
233       */       */
234      NavigableMap<K,V> descendingMap();      NavigableMap<K,V> descendingMap();
235    
236      /**      /**
237       * Returns a navigable set view of the keys contained in this navigable       * Returns a {@link NavigableSet} view of the keys contained in this map.
238       * map.  The set is backed by the map, so changes to the map are reflected       * The set's iterator returns the keys in ascending order.
239       * in the set, and vice-versa.  If the map is modified while an iteration       * The set is backed by the map, so changes to the map are reflected in
240       * over the set is in progress (except through the iterator's own       * the set, and vice-versa.  If the map is modified while an iteration
241       * {@code remove} operation), the results of the iteration are undefined.       * over the set is in progress (except through the iterator's own {@code
242       * The set supports element removal, which removes the corresponding       * remove} operation), the results of the iteration are undefined.  The
243       * mapping from the map, via the {@code Iterator.remove},       * set supports element removal, which removes the corresponding mapping
244       * {@code Set.remove}, {@code removeAll}, {@code retainAll}, and       * from the map, via the {@code Iterator.remove}, {@code Set.remove},
245       * {@code clear} operations.  It does not support the {@code add} or       * {@code removeAll}, {@code retainAll}, and {@code clear} operations.
246       * {@code addAll} operations.       * It does not support the {@code add} or {@code addAll} operations.
247       *       *
248       * @return a navigable set view of the keys contained in this navigable map       * @return a navigable set view of the keys in this map
249       */       */
250      NavigableSet<K> navigableKeySet();      NavigableSet<K> navigableKeySet();
251    
252      /**      /**
253       * Returns a {@link NavigableSet} view of the keys contained in this map.       * 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.       * The set's iterator returns the keys in descending order.
255       * The set is backed by the map, so changes to the map are       * The set is backed by the map, so changes to the map are reflected in
256       * reflected in the set, and vice-versa.  If the map is modified       * the set, and vice-versa.  If the map is modified while an iteration
257       * while an iteration over the set is in progress (except through       * over the set is in progress (except through the iterator's own {@code
258       * the iterator's own {@code remove} operation), the results of       * remove} operation), the results of the iteration are undefined.  The
259       * the iteration are undefined.  The set supports element removal,       * set supports element removal, which removes the corresponding mapping
260       * which removes the corresponding mapping from the map, via the       * from the map, via the {@code Iterator.remove}, {@code Set.remove},
261       * {@code Iterator.remove}, {@code Set.remove},       * {@code removeAll}, {@code retainAll}, and {@code clear} operations.
262       * {@code removeAll}, {@code retainAll}, and {@code clear}       * It does not support the {@code add} or {@code addAll} operations.
      * operations.  It does not support the {@code add} or {@code addAll}  
      * operations.  
263       *       *
264       * @return a set view of the keys contained in this map, sorted in       * @return a reverse order navigable set view of the keys in this map
      *         descending order  
265       */       */
266      NavigableSet<K> descendingKeySet();      NavigableSet<K> descendingKeySet();
267    
# Line 349  Line 361 
361      NavigableMap<K,V> tailMap(K fromKey, boolean inclusive);      NavigableMap<K,V> tailMap(K fromKey, boolean inclusive);
362    
363      /**      /**
364       * Equivalent to {@code subMap(fromKey, true, toKey, false)}       * {@inheritDoc}
      * but with a return type conforming to the {@code SortedMap} interface.  
365       *       *
366       * <p>{@inheritDoc}       * <p>Equivalent to {@code subMap(fromKey, true, toKey, false)}.
367       *       *
368       * @throws ClassCastException       {@inheritDoc}       * @throws ClassCastException       {@inheritDoc}
369       * @throws NullPointerException     {@inheritDoc}       * @throws NullPointerException     {@inheritDoc}
# Line 361  Line 372 
372      SortedMap<K,V> subMap(K fromKey, K toKey);      SortedMap<K,V> subMap(K fromKey, K toKey);
373    
374      /**      /**
375       * Equivalent to {@code headMap(toKey, false)}       * {@inheritDoc}
      * but with a return type conforming to the {@code SortedMap} interface.  
376       *       *
377       * <p>{@inheritDoc}       * <p>Equivalent to {@code headMap(toKey, false)}.
378       *       *
379       * @throws ClassCastException       {@inheritDoc}       * @throws ClassCastException       {@inheritDoc}
380       * @throws NullPointerException     {@inheritDoc}       * @throws NullPointerException     {@inheritDoc}
# Line 373  Line 383 
383      SortedMap<K,V> headMap(K toKey);      SortedMap<K,V> headMap(K toKey);
384    
385      /**      /**
386       * Equivalent to {@code tailMap(fromKey, true)}       * {@inheritDoc}
      * but with a return type conforming to the {@code SortedMap} interface.  
387       *       *
388       * <p>{@inheritDoc}       * <p>Equivalent to {@code tailMap(fromKey, true)}.
389       *       *
390       * @throws ClassCastException       {@inheritDoc}       * @throws ClassCastException       {@inheritDoc}
391       * @throws NullPointerException     {@inheritDoc}       * @throws NullPointerException     {@inheritDoc}

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8