21 |
|
* additionally defines methods <tt>pollFirst</tt> and |
22 |
|
* <t>pollLast</tt> that return and remove the lowest and highest key, |
23 |
|
* if one exists, else returning <tt>null</tt>. |
24 |
+ |
* Methods <tt>navigableSubSet</tt>, <tt>navigableHeadSet</tt>, and |
25 |
+ |
* <tt>navigableTailSet</tt> differ from the similarly named |
26 |
+ |
* <tt>SortedSet</tt> methods only in that the returned sets |
27 |
+ |
* are guaranteed to obey the <tt>NavigableSet</tt> interface. |
28 |
|
* |
29 |
|
* <p> The return values of navigation methods may be ambiguous in |
30 |
|
* implementations that permit <tt>null</tt> elements. However, even |
34 |
|
* <tt>null</tt> elements. (Note that sorted sets of {@link |
35 |
|
* Comparable} elements intrinsically do not permit <tt>null</tt>.) |
36 |
|
* |
37 |
+ |
* <p>This interface is a member of the |
38 |
+ |
* <a href="{@docRoot}/../guide/collections/index.html"> |
39 |
+ |
* Java Collections Framework</a>. |
40 |
+ |
* |
41 |
|
* @author Doug Lea |
42 |
|
* @param <E> the type of elements maintained by this set |
43 |
+ |
* @since 1.6 |
44 |
|
*/ |
45 |
|
public interface NavigableSet<E> extends SortedSet<E> { |
46 |
|
/** |
47 |
|
* Returns an element greater than or equal to the given element, or |
48 |
|
* <tt>null</tt> if there is no such element. |
49 |
< |
* |
50 |
< |
* @param o the value to match |
49 |
> |
* |
50 |
> |
* @param e the value to match |
51 |
|
* @return an element greater than or equal to given element, or |
52 |
|
* <tt>null</tt> if there is no such element. |
53 |
< |
* @throws ClassCastException if o cannot be compared with the elements |
53 |
> |
* @throws ClassCastException if e cannot be compared with the elements |
54 |
|
* currently in the set. |
55 |
< |
* @throws NullPointerException if o is <tt>null</tt> |
55 |
> |
* @throws NullPointerException if e is <tt>null</tt> |
56 |
|
* and this set does not permit <tt>null</tt> elements |
57 |
|
*/ |
58 |
< |
E ceiling(E o); |
58 |
> |
E ceiling(E e); |
59 |
|
|
60 |
|
/** |
61 |
|
* Returns an element strictly less than the given element, or |
62 |
|
* <tt>null</tt> if there is no such element. |
63 |
< |
* |
64 |
< |
* @param o the value to match |
63 |
> |
* |
64 |
> |
* @param e the value to match |
65 |
|
* @return the greatest element less than the given element, or |
66 |
|
* <tt>null</tt> if there is no such element. |
67 |
< |
* @throws ClassCastException if o cannot be compared with the elements |
67 |
> |
* @throws ClassCastException if e cannot be compared with the elements |
68 |
|
* currently in the set. |
69 |
< |
* @throws NullPointerException if o is <tt>null</tt> |
69 |
> |
* @throws NullPointerException if e is <tt>null</tt> |
70 |
|
* and this set does not permit <tt>null</tt> elements |
71 |
|
*/ |
72 |
< |
E lower(E o); |
72 |
> |
E lower(E e); |
73 |
|
|
74 |
|
/** |
75 |
|
* Returns an element less than or equal to the given element, or |
76 |
|
* <tt>null</tt> if there is no such element. |
77 |
< |
* |
78 |
< |
* @param o the value to match |
77 |
> |
* |
78 |
> |
* @param e the value to match |
79 |
|
* @return the greatest element less than or equal to given |
80 |
|
* element, or <tt>null</tt> if there is no such element. |
81 |
< |
* @throws ClassCastException if o cannot be compared with the elements |
81 |
> |
* @throws ClassCastException if e cannot be compared with the elements |
82 |
|
* currently in the set. |
83 |
< |
* @throws NullPointerException if o is <tt>null</tt>. |
83 |
> |
* @throws NullPointerException if e is <tt>null</tt>. |
84 |
|
* and this set does not permit <tt>null</tt> elements |
85 |
|
*/ |
86 |
< |
E floor(E o); |
86 |
> |
E floor(E e); |
87 |
|
|
88 |
|
/** |
89 |
|
* Returns an element strictly greater than the given element, or |
90 |
|
* <tt>null</tt> if there is no such element. |
91 |
< |
* |
92 |
< |
* @param o the value to match |
91 |
> |
* |
92 |
> |
* @param e the value to match |
93 |
|
* @return the least element greater than the given element, or |
94 |
|
* <tt>null</tt> if there is no such element. |
95 |
< |
* @throws ClassCastException if o cannot be compared with the elements |
95 |
> |
* @throws ClassCastException if e cannot be compared with the elements |
96 |
|
* currently in the set. |
97 |
< |
* @throws NullPointerException if o is <tt>null</tt> |
97 |
> |
* @throws NullPointerException if e is <tt>null</tt> |
98 |
|
* and this set does not permit <tt>null</tt> elements |
99 |
|
*/ |
100 |
< |
E higher(E o); |
100 |
> |
E higher(E e); |
101 |
|
|
102 |
|
/** |
103 |
|
* Retrieves and removes the first (lowest) element. |
115 |
|
|
116 |
|
/** |
117 |
|
* Returns an iterator over the elements in this collection, in |
118 |
< |
* descending order. |
119 |
< |
* |
118 |
> |
* descending order. |
119 |
> |
* |
120 |
|
* @return an <tt>Iterator</tt> over the elements in this collection |
121 |
|
*/ |
122 |
|
Iterator<E> descendingIterator(); |
127 |
|
* exclusive. (If <tt>fromElement</tt> and <tt>toElement</tt> are |
128 |
|
* equal, the returned navigable set is empty.) The returned |
129 |
|
* navigable set is backed by this set, so changes in the returned |
130 |
< |
* navigable set are reflected in this set, and vice-versa. Note: |
122 |
< |
* This method differs from <tt>SortedSet.subSet</tt> only in that |
123 |
< |
* the returned set is guaranteed to support the |
124 |
< |
* <tt>NavigableSet</tt> interface. |
130 |
> |
* navigable set are reflected in this set, and vice-versa. |
131 |
|
* |
132 |
|
* @param fromElement low endpoint (inclusive) of the subSet. |
133 |
|
* @param toElement high endpoint (exclusive) of the subSet. |
141 |
|
* @throws IllegalArgumentException if <tt>fromElement</tt> is |
142 |
|
* greater than <tt>toElement</tt>. |
143 |
|
* @throws NullPointerException if <tt>fromElement</tt> or |
144 |
< |
* <tt>toElement</tt> is <tt>null</tt> |
144 |
> |
* <tt>toElement</tt> is <tt>null</tt> |
145 |
|
* and this set does not permit <tt>null</tt> elements |
146 |
|
*/ |
147 |
|
NavigableSet<E> navigableSubSet(E fromElement, E toElement); |