KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > util > concurrent > ConcurrentNavigableMap


1 /*
2  * @(#)ConcurrentNavigableMap.java 1.5 06/05/10
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.util.concurrent;
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 JavaDoc<K,V>, NavigableMap<K,V>
26 {
27     /**
28      * @throws ClassCastException {@inheritDoc}
29      * @throws NullPointerException {@inheritDoc}
30      * @throws IllegalArgumentException {@inheritDoc}
31      */

32     ConcurrentNavigableMap JavaDoc<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 JavaDoc<K,V> headMap(K toKey, boolean inclusive);
41
42
43     /**
44      * @throws ClassCastException {@inheritDoc}
45      * @throws NullPointerException {@inheritDoc}
46      * @throws IllegalArgumentException {@inheritDoc}
47      */

48     ConcurrentNavigableMap JavaDoc<K,V> tailMap(K fromKey, boolean inclusive);
49
50     /**
51      * @throws ClassCastException {@inheritDoc}
52      * @throws NullPointerException {@inheritDoc}
53      * @throws IllegalArgumentException {@inheritDoc}
54      */

55     ConcurrentNavigableMap JavaDoc<K,V> subMap(K fromKey, K toKey);
56
57     /**
58      * @throws ClassCastException {@inheritDoc}
59      * @throws NullPointerException {@inheritDoc}
60      * @throws IllegalArgumentException {@inheritDoc}
61      */

62     ConcurrentNavigableMap JavaDoc<K,V> headMap(K toKey);
63
64     /**
65      * @throws ClassCastException {@inheritDoc}
66      * @throws NullPointerException {@inheritDoc}
67      * @throws IllegalArgumentException {@inheritDoc}
68      */

69     ConcurrentNavigableMap JavaDoc<K,V> tailMap(K fromKey);
70
71     /**
72      * Returns a reverse order view of the mappings contained in this map.
73      * The descending map is backed by this map, so changes to the map are
74      * reflected in the descending map, and vice-versa.
75      *
76      * <p>The returned map has an ordering equivalent to
77      * <tt>{@link Collections#reverseOrder(Comparator) Collections.reverseOrder}(comparator())</tt>.
78      * The expression {@code m.descendingMap().descendingMap()} returns a
79      * view of {@code m} essentially equivalent to {@code m}.
80      *
81      * @return a reverse order view of this map
82      */

83     ConcurrentNavigableMap JavaDoc<K,V> descendingMap();
84
85     /**
86      * Returns a {@link NavigableSet} view of the keys contained in this map.
87      * The set's iterator returns the keys in ascending order.
88      * The set is backed by the map, so changes to the map are
89      * reflected in the set, and vice-versa. The set supports element
90      * removal, which removes the corresponding mapping from the map,
91      * via the {@code Iterator.remove}, {@code Set.remove},
92      * {@code removeAll}, {@code retainAll}, and {@code clear}
93      * operations. It does not support the {@code add} or {@code addAll}
94      * operations.
95      *
96      * <p>The view's {@code iterator} is a "weakly consistent" iterator
97      * that will never throw {@link ConcurrentModificationException},
98      * and guarantees to traverse elements as they existed upon
99      * construction of the iterator, and may (but is not guaranteed to)
100      * reflect any modifications subsequent to construction.
101      *
102      * @return a navigable set view of the keys in this map
103      */

104     public NavigableSet<K> navigableKeySet();
105
106     /**
107      * Returns a {@link NavigableSet} view of the keys contained in this map.
108      * The set's iterator returns the keys in ascending order.
109      * The set is backed by the map, so changes to the map are
110      * reflected in the set, and vice-versa. The set supports element
111      * removal, which removes the corresponding mapping from the map,
112      * via the {@code Iterator.remove}, {@code Set.remove},
113      * {@code removeAll}, {@code retainAll}, and {@code clear}
114      * operations. It does not support the {@code add} or {@code addAll}
115      * operations.
116      *
117      * <p>The view's {@code iterator} is a "weakly consistent" iterator
118      * that will never throw {@link ConcurrentModificationException},
119      * and guarantees to traverse elements as they existed upon
120      * construction of the iterator, and may (but is not guaranteed to)
121      * reflect any modifications subsequent to construction.
122      *
123      * <p>This method is equivalent to method {@code navigableKeySet}.
124      *
125      * @return a navigable set view of the keys in this map
126      */

127     NavigableSet<K> keySet();
128
129     /**
130      * Returns a reverse order {@link NavigableSet} view of the keys contained in this map.
131      * The set's iterator returns the keys in descending order.
132      * The set is backed by the map, so changes to the map are
133      * reflected in the set, and vice-versa. The set supports element
134      * removal, which removes the corresponding mapping from the map,
135      * via the {@code Iterator.remove}, {@code Set.remove},
136      * {@code removeAll}, {@code retainAll}, and {@code clear}
137      * operations. It does not support the {@code add} or {@code addAll}
138      * operations.
139      *
140      * <p>The view's {@code iterator} is a "weakly consistent" iterator
141      * that will never throw {@link ConcurrentModificationException},
142      * and guarantees to traverse elements as they existed upon
143      * construction of the iterator, and may (but is not guaranteed to)
144      * reflect any modifications subsequent to construction.
145      *
146      * @return a reverse order navigable set view of the keys in this map
147      */

148     public NavigableSet<K> descendingKeySet();
149 }
150
Popular Tags