1 |
/* |
2 |
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
* Expert Group and released to the public domain, as explained at |
4 |
* http://creativecommons.org/licenses/publicdomain |
5 |
*/ |
6 |
|
7 |
package java.util.concurrent; |
8 |
import java.util.*; |
9 |
|
10 |
/** |
11 |
* A {@link ConcurrentMap} supporting {@link NavigableMap} operations. |
12 |
* |
13 |
* @author Doug Lea |
14 |
* @param <K> the type of keys maintained by this map |
15 |
* @param <V> the type of mapped values |
16 |
*/ |
17 |
public interface ConcurrentNavigableMap<K,V> extends ConcurrentMap<K,V>, NavigableMap<K,V> { |
18 |
/** |
19 |
* Returns a view of the portion of this map whose keys range from |
20 |
* <tt>fromKey</tt>, inclusive, to <tt>toKey</tt>, exclusive. (If |
21 |
* <tt>fromKey</tt> and <tt>toKey</tt> are equal, the returned sorted map |
22 |
* is empty.) The returned sorted map is backed by this map, so changes |
23 |
* in the returned sorted map are reflected in this map, and vice-versa. |
24 |
|
25 |
* @param fromKey low endpoint (inclusive) of the subMap. |
26 |
* @param toKey high endpoint (exclusive) of the subMap. |
27 |
* |
28 |
* @return a view of the portion of this map whose keys range from |
29 |
* <tt>fromKey</tt>, inclusive, to <tt>toKey</tt>, exclusive. |
30 |
* |
31 |
* @throws ClassCastException if <tt>fromKey</tt> and |
32 |
* <tt>toKey</tt> cannot be compared to one another using this |
33 |
* map's comparator (or, if the map has no comparator, using |
34 |
* natural ordering). |
35 |
* @throws IllegalArgumentException if <tt>fromKey</tt> is greater |
36 |
* than <tt>toKey</tt>. |
37 |
* @throws NullPointerException if <tt>fromKey</tt> or |
38 |
* <tt>toKey</tt> is <tt>null</tt> and this map does not support |
39 |
* <tt>null</tt> keys. |
40 |
*/ |
41 |
public ConcurrentNavigableMap<K,V> navigableSubMap(K fromKey, K toKey); |
42 |
|
43 |
/** |
44 |
* Returns a view of the portion of this map whose keys are strictly less |
45 |
* than <tt>toKey</tt>. The returned sorted map is backed by this map, so |
46 |
* changes in the returned sorted map are reflected in this map, and |
47 |
* vice-versa. |
48 |
* @param toKey high endpoint (exclusive) of the headMap. |
49 |
* @return a view of the portion of this map whose keys are strictly |
50 |
* less than <tt>toKey</tt>. |
51 |
* |
52 |
* @throws ClassCastException if <tt>toKey</tt> is not compatible |
53 |
* with this map's comparator (or, if the map has no comparator, |
54 |
* if <tt>toKey</tt> does not implement <tt>Comparable</tt>). |
55 |
* @throws NullPointerException if <tt>toKey</tt> is <tt>null</tt> |
56 |
* and this map does not support <tt>null</tt> keys. |
57 |
*/ |
58 |
public ConcurrentNavigableMap<K,V> navigableHeadMap(K toKey); |
59 |
|
60 |
/** |
61 |
* Returns a view of the portion of this map whose keys are |
62 |
* greater than or equal to <tt>fromKey</tt>. The returned sorted |
63 |
* map is backed by this map, so changes in the returned sorted |
64 |
* map are reflected in this map, and vice-versa. |
65 |
* @param fromKey low endpoint (inclusive) of the tailMap. |
66 |
* @return a view of the portion of this map whose keys are greater |
67 |
* than or equal to <tt>fromKey</tt>. |
68 |
* @throws ClassCastException if <tt>fromKey</tt> is not compatible |
69 |
* with this map's comparator (or, if the map has no comparator, |
70 |
* if <tt>fromKey</tt> does not implement <tt>Comparable</tt>). |
71 |
* @throws NullPointerException if <tt>fromKey</tt> is <tt>null</tt> |
72 |
* and this map does not support <tt>null</tt> keys. |
73 |
*/ |
74 |
public ConcurrentNavigableMap<K,V> navigableTailMap(K fromKey); |
75 |
} |