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 java.util.concurrent; |
8 |
|
9 |
import java.util.*; |
10 |
|
11 |
/** |
12 |
* A {@link ConcurrentMap} supporting {@link NavigableMap} operations, |
13 |
* and recursively so for its navigable sub-maps. |
14 |
* |
15 |
* <p>This interface is a member of the |
16 |
* <a href="{@docRoot}/../technotes/guides/collections/index.html"> |
17 |
* Java Collections Framework</a>. |
18 |
* |
19 |
* @author Doug Lea |
20 |
* @param <K> the type of keys maintained by this map |
21 |
* @param <V> the type of mapped values |
22 |
* @since 1.6 |
23 |
*/ |
24 |
public interface ConcurrentNavigableMap<K,V> |
25 |
extends ConcurrentMap<K,V>, NavigableMap<K,V> |
26 |
{ |
27 |
/** |
28 |
* @throws ClassCastException {@inheritDoc} |
29 |
* @throws NullPointerException {@inheritDoc} |
30 |
* @throws IllegalArgumentException {@inheritDoc} |
31 |
*/ |
32 |
ConcurrentNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, |
33 |
K toKey, boolean toInclusive); |
34 |
|
35 |
/** |
36 |
* @throws ClassCastException {@inheritDoc} |
37 |
* @throws NullPointerException {@inheritDoc} |
38 |
* @throws IllegalArgumentException {@inheritDoc} |
39 |
*/ |
40 |
ConcurrentNavigableMap<K,V> headMap(K toKey, boolean inclusive); |
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 |
* @throws ClassCastException {@inheritDoc} |
51 |
* @throws NullPointerException {@inheritDoc} |
52 |
* @throws IllegalArgumentException {@inheritDoc} |
53 |
*/ |
54 |
ConcurrentNavigableMap<K,V> subMap(K fromKey, K toKey); |
55 |
|
56 |
/** |
57 |
* @throws ClassCastException {@inheritDoc} |
58 |
* @throws NullPointerException {@inheritDoc} |
59 |
* @throws IllegalArgumentException {@inheritDoc} |
60 |
*/ |
61 |
ConcurrentNavigableMap<K,V> headMap(K toKey); |
62 |
|
63 |
/** |
64 |
* @throws ClassCastException {@inheritDoc} |
65 |
* @throws NullPointerException {@inheritDoc} |
66 |
* @throws IllegalArgumentException {@inheritDoc} |
67 |
*/ |
68 |
ConcurrentNavigableMap<K,V> tailMap(K fromKey); |
69 |
|
70 |
/** |
71 |
* Returns a reverse order view of the mappings contained in this map. |
72 |
* The descending map is backed by this map, so changes to the map are |
73 |
* reflected in the descending map, and vice-versa. |
74 |
* |
75 |
* <p>The returned map has an ordering equivalent to |
76 |
* {@link Collections#reverseOrder(Comparator) Collections.reverseOrder}{@code (comparator())}. |
77 |
* The expression {@code m.descendingMap().descendingMap()} returns a |
78 |
* view of {@code m} essentially equivalent to {@code m}. |
79 |
* |
80 |
* @return a reverse order view of this map |
81 |
*/ |
82 |
ConcurrentNavigableMap<K,V> descendingMap(); |
83 |
|
84 |
/** |
85 |
* Returns a {@link NavigableSet} view of the keys contained in this map. |
86 |
* The set's iterator returns the keys in ascending order. |
87 |
* The set is backed by the map, so changes to the map are |
88 |
* reflected in the set, and vice-versa. The set supports element |
89 |
* removal, which removes the corresponding mapping from the map, |
90 |
* via the {@code Iterator.remove}, {@code Set.remove}, |
91 |
* {@code removeAll}, {@code retainAll}, and {@code clear} |
92 |
* operations. It does not support the {@code add} or {@code addAll} |
93 |
* operations. |
94 |
* |
95 |
* <p>The view's {@code iterator} is a "weakly consistent" iterator |
96 |
* that will never throw {@link ConcurrentModificationException}, |
97 |
* and guarantees to traverse elements as they existed upon |
98 |
* construction of the iterator, and may (but is not guaranteed to) |
99 |
* reflect any modifications subsequent to construction. |
100 |
* |
101 |
* @return a navigable set view of the keys in this map |
102 |
*/ |
103 |
public NavigableSet<K> navigableKeySet(); |
104 |
|
105 |
/** |
106 |
* Returns a {@link NavigableSet} view of the keys contained in this map. |
107 |
* The set's iterator returns the keys in ascending order. |
108 |
* The set is backed by the map, so changes to the map are |
109 |
* reflected in the set, and vice-versa. The set supports element |
110 |
* removal, which removes the corresponding mapping from the map, |
111 |
* via the {@code Iterator.remove}, {@code Set.remove}, |
112 |
* {@code removeAll}, {@code retainAll}, and {@code clear} |
113 |
* operations. It does not support the {@code add} or {@code addAll} |
114 |
* operations. |
115 |
* |
116 |
* <p>The view's {@code iterator} is a "weakly consistent" iterator |
117 |
* that will never throw {@link ConcurrentModificationException}, |
118 |
* and guarantees to traverse elements as they existed upon |
119 |
* construction of the iterator, and may (but is not guaranteed to) |
120 |
* reflect any modifications subsequent to construction. |
121 |
* |
122 |
* <p>This method is equivalent to method {@code navigableKeySet}. |
123 |
* |
124 |
* @return a navigable set view of the keys in this map |
125 |
*/ |
126 |
NavigableSet<K> keySet(); |
127 |
|
128 |
/** |
129 |
* Returns a reverse order {@link NavigableSet} view of the keys contained in this map. |
130 |
* The set's iterator returns the keys in descending order. |
131 |
* The set is backed by the map, so changes to the map are |
132 |
* reflected in the set, and vice-versa. The set supports element |
133 |
* removal, which removes the corresponding mapping from the map, |
134 |
* via the {@code Iterator.remove}, {@code Set.remove}, |
135 |
* {@code removeAll}, {@code retainAll}, and {@code clear} |
136 |
* operations. It does not support the {@code add} or {@code addAll} |
137 |
* operations. |
138 |
* |
139 |
* <p>The view's {@code iterator} is a "weakly consistent" iterator |
140 |
* that will never throw {@link ConcurrentModificationException}, |
141 |
* and guarantees to traverse elements as they existed upon |
142 |
* construction of the iterator, and may (but is not guaranteed to) |
143 |
* reflect any modifications subsequent to construction. |
144 |
* |
145 |
* @return a reverse order navigable set view of the keys in this map |
146 |
*/ |
147 |
public NavigableSet<K> descendingKeySet(); |
148 |
} |