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 |
* and recursively so for its navigable sub-maps. |
13 |
* |
14 |
* <p>This interface is a member of the |
15 |
* <a href="{@docRoot}/../guide/collections/index.html"> |
16 |
* Java Collections Framework</a>. |
17 |
* |
18 |
* @author Doug Lea |
19 |
* @param <K> the type of keys maintained by this map |
20 |
* @param <V> the type of mapped values |
21 |
* @since 1.6 |
22 |
*/ |
23 |
public interface ConcurrentNavigableMap<K,V> |
24 |
extends ConcurrentMap<K,V>, NavigableMap<K,V> |
25 |
{ |
26 |
/** |
27 |
* @throws ClassCastException {@inheritDoc} |
28 |
* @throws NullPointerException {@inheritDoc} |
29 |
* @throws IllegalArgumentException {@inheritDoc} |
30 |
*/ |
31 |
ConcurrentNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, |
32 |
K toKey, boolean toInclusive); |
33 |
|
34 |
/** |
35 |
* @throws ClassCastException {@inheritDoc} |
36 |
* @throws NullPointerException {@inheritDoc} |
37 |
* @throws IllegalArgumentException {@inheritDoc} |
38 |
*/ |
39 |
ConcurrentNavigableMap<K,V> headMap(K toKey, boolean inclusive); |
40 |
|
41 |
|
42 |
/** |
43 |
* @throws ClassCastException {@inheritDoc} |
44 |
* @throws NullPointerException {@inheritDoc} |
45 |
* @throws IllegalArgumentException {@inheritDoc} |
46 |
*/ |
47 |
ConcurrentNavigableMap<K,V> tailMap(K fromKey, boolean inclusive); |
48 |
|
49 |
/** |
50 |
* Returns a view of the portion of this map whose keys range from |
51 |
* {@code fromKey}, inclusive, to {@code toKey}, exclusive. (If |
52 |
* {@code fromKey} and {@code toKey} are equal, the returned map |
53 |
* is empty.) The returned map is backed by this map, so changes |
54 |
* in the returned map are reflected in this map, and vice-versa. |
55 |
* The returned map supports all optional map operations that this |
56 |
* map supports. |
57 |
* |
58 |
* <p>The returned map will throw an {@code IllegalArgumentException} |
59 |
* on an attempt to insert a key outside its range. |
60 |
* |
61 |
* <p>Equivalent to {@code subMap(fromKey, true, toKey, false)}. |
62 |
* |
63 |
* @throws ClassCastException {@inheritDoc} |
64 |
* @throws NullPointerException {@inheritDoc} |
65 |
* @throws IllegalArgumentException {@inheritDoc} |
66 |
*/ |
67 |
ConcurrentNavigableMap<K,V> subMap(K fromKey, K toKey); |
68 |
|
69 |
/** |
70 |
* Returns a view of the portion of this map whose keys are |
71 |
* strictly less than {@code toKey}. The returned map is backed |
72 |
* by this map, so changes in the returned map are reflected in |
73 |
* this map, and vice-versa. The returned map supports all |
74 |
* optional map operations that this map supports. |
75 |
* |
76 |
* <p>The returned map will throw an {@code IllegalArgumentException} |
77 |
* on an attempt to insert a key outside its range. |
78 |
* |
79 |
* <p>Equivalent to {@code headMap(toKey, false)}. |
80 |
* |
81 |
* @throws ClassCastException {@inheritDoc} |
82 |
* @throws NullPointerException {@inheritDoc} |
83 |
* @throws IllegalArgumentException {@inheritDoc} |
84 |
*/ |
85 |
ConcurrentNavigableMap<K,V> headMap(K toKey); |
86 |
|
87 |
/** |
88 |
* Returns a view of the portion of this map whose keys are |
89 |
* greater than or equal to {@code fromKey}. The returned map is |
90 |
* backed by this map, so changes in the returned map are |
91 |
* reflected in this map, and vice-versa. The returned map |
92 |
* supports all optional map operations that this map supports. |
93 |
* |
94 |
* <p>The returned map will throw an {@code IllegalArgumentException} |
95 |
* on an attempt to insert a key outside its range. |
96 |
* |
97 |
* <p>Equivalent to {@code tailMap(fromKey, true)}. |
98 |
* |
99 |
* @throws ClassCastException {@inheritDoc} |
100 |
* @throws NullPointerException {@inheritDoc} |
101 |
* @throws IllegalArgumentException {@inheritDoc} |
102 |
*/ |
103 |
ConcurrentNavigableMap<K,V> tailMap(K fromKey); |
104 |
|
105 |
ConcurrentNavigableMap<K,V> descendingMap(); |
106 |
} |