< prev index next >

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

Print this page




  72  *
  73  * <p>Note: several methods return subsets with restricted ranges.
  74  * Such ranges are <i>half-open</i>, that is, they include their low
  75  * endpoint but not their high endpoint (where applicable).
  76  * If you need a <i>closed range</i> (which includes both endpoints), and
  77  * the element type allows for calculation of the successor of a given
  78  * value, merely request the subrange from {@code lowEndpoint} to
  79  * {@code successor(highEndpoint)}.  For example, suppose that {@code s}
  80  * is a sorted set of strings.  The following idiom obtains a view
  81  * containing all of the strings in {@code s} from {@code low} to
  82  * {@code high}, inclusive:<pre>
  83  *   SortedSet&lt;String&gt; sub = s.subSet(low, high+"\0");</pre>
  84  *
  85  * A similar technique can be used to generate an <i>open range</i> (which
  86  * contains neither endpoint).  The following idiom obtains a view
  87  * containing all of the Strings in {@code s} from {@code low} to
  88  * {@code high}, exclusive:<pre>
  89  *   SortedSet&lt;String&gt; sub = s.subSet(low+"\0", high);</pre>
  90  *
  91  * <p>This interface is a member of the
  92  * <a href="{@docRoot}/java/util/package-summary.html#CollectionsFramework">
  93  * Java Collections Framework</a>.
  94  *
  95  * @param <E> the type of elements maintained by this set
  96  *
  97  * @author  Josh Bloch
  98  * @see Set
  99  * @see TreeSet
 100  * @see SortedMap
 101  * @see Collection
 102  * @see Comparable
 103  * @see Comparator
 104  * @see ClassCastException
 105  * @since 1.2
 106  */
 107 
 108 public interface SortedSet<E> extends Set<E> {
 109     /**
 110      * Returns the comparator used to order the elements in this set,
 111      * or {@code null} if this set uses the {@linkplain Comparable
 112      * natural ordering} of its elements.




  72  *
  73  * <p>Note: several methods return subsets with restricted ranges.
  74  * Such ranges are <i>half-open</i>, that is, they include their low
  75  * endpoint but not their high endpoint (where applicable).
  76  * If you need a <i>closed range</i> (which includes both endpoints), and
  77  * the element type allows for calculation of the successor of a given
  78  * value, merely request the subrange from {@code lowEndpoint} to
  79  * {@code successor(highEndpoint)}.  For example, suppose that {@code s}
  80  * is a sorted set of strings.  The following idiom obtains a view
  81  * containing all of the strings in {@code s} from {@code low} to
  82  * {@code high}, inclusive:<pre>
  83  *   SortedSet&lt;String&gt; sub = s.subSet(low, high+"\0");</pre>
  84  *
  85  * A similar technique can be used to generate an <i>open range</i> (which
  86  * contains neither endpoint).  The following idiom obtains a view
  87  * containing all of the Strings in {@code s} from {@code low} to
  88  * {@code high}, exclusive:<pre>
  89  *   SortedSet&lt;String&gt; sub = s.subSet(low+"\0", high);</pre>
  90  *
  91  * <p>This interface is a member of the
  92  * <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
  93  * Java Collections Framework</a>.
  94  *
  95  * @param <E> the type of elements maintained by this set
  96  *
  97  * @author  Josh Bloch
  98  * @see Set
  99  * @see TreeSet
 100  * @see SortedMap
 101  * @see Collection
 102  * @see Comparable
 103  * @see Comparator
 104  * @see ClassCastException
 105  * @since 1.2
 106  */
 107 
 108 public interface SortedSet<E> extends Set<E> {
 109     /**
 110      * Returns the comparator used to order the elements in this set,
 111      * or {@code null} if this set uses the {@linkplain Comparable
 112      * natural ordering} of its elements.


< prev index next >