< prev index next >

src/java.base/share/classes/java/util/NavigableSet.java

Print this page




  62  *
  63  * <p>The return values of navigation methods may be ambiguous in
  64  * implementations that permit {@code null} elements. However, even
  65  * in this case the result can be disambiguated by checking
  66  * {@code contains(null)}. To avoid such issues, implementations of
  67  * this interface are encouraged to <em>not</em> permit insertion of
  68  * {@code null} elements. (Note that sorted sets of {@link
  69  * Comparable} elements intrinsically do not permit {@code null}.)
  70  *
  71  * <p>Methods
  72  * {@link #subSet(Object, Object) subSet(E, E)},
  73  * {@link #headSet(Object) headSet(E)}, and
  74  * {@link #tailSet(Object) tailSet(E)}
  75  * are specified to return {@code SortedSet} to allow existing
  76  * implementations of {@code SortedSet} to be compatibly retrofitted to
  77  * implement {@code NavigableSet}, but extensions and implementations
  78  * of this interface are encouraged to override these methods to return
  79  * {@code NavigableSet}.
  80  *
  81  * <p>This interface is a member of the
  82  * <a href="{@docRoot}/java/util/package-summary.html#CollectionsFramework">
  83  * Java Collections Framework</a>.
  84  *
  85  * @author Doug Lea
  86  * @author Josh Bloch
  87  * @param <E> the type of elements maintained by this set
  88  * @since 1.6
  89  */
  90 public interface NavigableSet<E> extends SortedSet<E> {
  91     /**
  92      * Returns the greatest element in this set strictly less than the
  93      * given element, or {@code null} if there is no such element.
  94      *
  95      * @param e the value to match
  96      * @return the greatest element less than {@code e},
  97      *         or {@code null} if there is no such element
  98      * @throws ClassCastException if the specified element cannot be
  99      *         compared with the elements currently in the set
 100      * @throws NullPointerException if the specified element is null
 101      *         and this set does not permit null elements
 102      */




  62  *
  63  * <p>The return values of navigation methods may be ambiguous in
  64  * implementations that permit {@code null} elements. However, even
  65  * in this case the result can be disambiguated by checking
  66  * {@code contains(null)}. To avoid such issues, implementations of
  67  * this interface are encouraged to <em>not</em> permit insertion of
  68  * {@code null} elements. (Note that sorted sets of {@link
  69  * Comparable} elements intrinsically do not permit {@code null}.)
  70  *
  71  * <p>Methods
  72  * {@link #subSet(Object, Object) subSet(E, E)},
  73  * {@link #headSet(Object) headSet(E)}, and
  74  * {@link #tailSet(Object) tailSet(E)}
  75  * are specified to return {@code SortedSet} to allow existing
  76  * implementations of {@code SortedSet} to be compatibly retrofitted to
  77  * implement {@code NavigableSet}, but extensions and implementations
  78  * of this interface are encouraged to override these methods to return
  79  * {@code NavigableSet}.
  80  *
  81  * <p>This interface is a member of the
  82  * <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
  83  * Java Collections Framework</a>.
  84  *
  85  * @author Doug Lea
  86  * @author Josh Bloch
  87  * @param <E> the type of elements maintained by this set
  88  * @since 1.6
  89  */
  90 public interface NavigableSet<E> extends SortedSet<E> {
  91     /**
  92      * Returns the greatest element in this set strictly less than the
  93      * given element, or {@code null} if there is no such element.
  94      *
  95      * @param e the value to match
  96      * @return the greatest element less than {@code e},
  97      *         or {@code null} if there is no such element
  98      * @throws ClassCastException if the specified element cannot be
  99      *         compared with the elements currently in the set
 100      * @throws NullPointerException if the specified element is null
 101      *         and this set does not permit null elements
 102      */


< prev index next >