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>SubMap</tt>. |
29 |
< |
* |
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 that the returned maps |
32 |
> |
* are guaranteed to obey the <tt>NavigableMap</tt> interface. |
33 |
> |
* |
34 |
|
* <p>This interface additionally defines methods <tt>firstEntry</tt>, |
35 |
|
* <tt>pollFirstEntry</tt>, <tt>lastEntry</tt>, and |
36 |
|
* <tt>pollLastEntry</tt> that return and/or remove the least and |
43 |
|
* that it is possible to change mappings in the associated map using |
44 |
|
* method <tt>put</tt>. |
45 |
|
* |
46 |
+ |
* <p>This interface is a member of the |
47 |
+ |
* <a href="{@docRoot}/../guide/collections/index.html"> |
48 |
+ |
* Java Collections Framework</a>. |
49 |
+ |
* |
50 |
|
* @author Doug Lea |
51 |
|
* @param <K> the type of keys maintained by this map |
52 |
< |
* @param <V> the type of mapped values |
52 |
> |
* @param <V> the type of mapped values |
53 |
> |
* @since 1.6 |
54 |
|
*/ |
55 |
|
public interface NavigableMap<K,V> extends SortedMap<K,V> { |
56 |
|
/** |
57 |
|
* Returns a key-value mapping associated with the least key |
58 |
|
* greater than or equal to the given key, or <tt>null</tt> if there is |
59 |
< |
* no such entry. |
60 |
< |
* |
59 |
> |
* no such entry. |
60 |
> |
* |
61 |
|
* @param key the key. |
62 |
|
* @return an Entry associated with ceiling of given key, or <tt>null</tt> |
63 |
|
* if there is no such Entry. |
71 |
|
/** |
72 |
|
* Returns least key greater than or equal to the given key, or |
73 |
|
* <tt>null</tt> if there is no such key. |
74 |
< |
* |
74 |
> |
* |
75 |
|
* @param key the key. |
76 |
|
* @return the ceiling key, or <tt>null</tt> |
77 |
|
* if there is no such key. |
85 |
|
/** |
86 |
|
* Returns a key-value mapping associated with the greatest |
87 |
|
* key strictly less than the given key, or <tt>null</tt> if there is no |
88 |
< |
* such entry. |
89 |
< |
* |
88 |
> |
* such entry. |
89 |
> |
* |
90 |
|
* @param key the key. |
91 |
|
* @return an Entry with greatest key less than the given |
92 |
|
* key, or <tt>null</tt> if there is no such Entry. |
100 |
|
/** |
101 |
|
* Returns the greatest key strictly less than the given key, or |
102 |
|
* <tt>null</tt> if there is no such key. |
103 |
< |
* |
103 |
> |
* |
104 |
|
* @param key the key. |
105 |
|
* @return the greatest key less than the given |
106 |
|
* key, or <tt>null</tt> if there is no such key. |
115 |
|
* Returns a key-value mapping associated with the greatest key |
116 |
|
* less than or equal to the given key, or <tt>null</tt> if there |
117 |
|
* is no such entry. |
118 |
< |
* |
118 |
> |
* |
119 |
|
* @param key the key. |
120 |
|
* @return an Entry associated with floor of given key, or <tt>null</tt> |
121 |
|
* if there is no such Entry. |
130 |
|
* Returns the greatest key |
131 |
|
* less than or equal to the given key, or <tt>null</tt> if there |
132 |
|
* is no such key. |
133 |
< |
* |
133 |
> |
* |
134 |
|
* @param key the key. |
135 |
|
* @return the floor of given key, or <tt>null</tt> if there is no |
136 |
|
* such key. |
145 |
|
* Returns a key-value mapping associated with the least key |
146 |
|
* strictly greater than the given key, or <tt>null</tt> if there |
147 |
|
* is no such entry. |
148 |
< |
* |
148 |
> |
* |
149 |
|
* @param key the key. |
150 |
|
* @return an Entry with least key greater than the given key, or |
151 |
|
* <tt>null</tt> if there is no such Entry. |
159 |
|
/** |
160 |
|
* Returns the least key strictly greater than the given key, or |
161 |
|
* <tt>null</tt> if there is no such key. |
162 |
< |
* |
162 |
> |
* |
163 |
|
* @param key the key. |
164 |
|
* @return the least key greater than the given key, or |
165 |
|
* <tt>null</tt> if there is no such key. |
173 |
|
/** |
174 |
|
* Returns a key-value mapping associated with the least |
175 |
|
* key in this map, or <tt>null</tt> if the map is empty. |
176 |
< |
* |
177 |
< |
* @return an Entry with least key, or <tt>null</tt> |
176 |
> |
* |
177 |
> |
* @return an Entry with least key, or <tt>null</tt> |
178 |
|
* if the map is empty. |
179 |
|
*/ |
180 |
|
Map.Entry<K,V> firstEntry(); |
182 |
|
/** |
183 |
|
* Returns a key-value mapping associated with the greatest |
184 |
|
* key in this map, or <tt>null</tt> if the map is empty. |
185 |
< |
* |
185 |
> |
* |
186 |
|
* @return an Entry with greatest key, or <tt>null</tt> |
187 |
|
* if the map is empty. |
188 |
|
*/ |
191 |
|
/** |
192 |
|
* Removes and returns a key-value mapping associated with |
193 |
|
* the least key in this map, or <tt>null</tt> if the map is empty. |
194 |
< |
* |
194 |
> |
* |
195 |
|
* @return the removed first entry of this map, or <tt>null</tt> |
196 |
|
* if the map is empty. |
197 |
|
*/ |
200 |
|
/** |
201 |
|
* Removes and returns a key-value mapping associated with |
202 |
|
* the greatest key in this map, or <tt>null</tt> if the map is empty. |
203 |
< |
* |
203 |
> |
* |
204 |
|
* @return the removed last entry of this map, or <tt>null</tt> |
205 |
|
* if the map is empty. |
206 |
|
*/ |
249 |
|
* <tt>fromKey</tt> and <tt>toKey</tt> are equal, the returned |
250 |
|
* navigable map is empty.) The returned navigable map is backed |
251 |
|
* by this map, so changes in the returned navigable map are |
252 |
< |
* reflected in this map, and vice-versa. Note: This |
244 |
< |
* method differs from <tt>SortedMap.subMap</tt> only |
245 |
< |
* in that the returned map is guaranteed to support the |
246 |
< |
* <tt>NavigableMap</tt> interface. |
252 |
> |
* reflected in this map, and vice-versa. |
253 |
|
* |
254 |
|
* @param fromKey low endpoint (inclusive) of the subMap. |
255 |
|
* @param toKey high endpoint (exclusive) of the subMap. |
273 |
|
* Returns a view of the portion of this map whose keys are strictly less |
274 |
|
* than <tt>toKey</tt>. The returned navigable map is backed by this map, so |
275 |
|
* changes in the returned navigable map are reflected in this map, and |
276 |
< |
* vice-versa. |
276 |
> |
* vice-versa. |
277 |
|
* @param toKey high endpoint (exclusive) of the headMap. |
278 |
|
* @return a view of the portion of this map whose keys are strictly |
279 |
|
* less than <tt>toKey</tt>. |