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