14 |
|
import java.util.Arrays; |
15 |
|
import java.util.Collection; |
16 |
|
import java.util.Comparator; |
17 |
– |
import java.util.ConcurrentModificationException; |
17 |
|
import java.util.Enumeration; |
18 |
|
import java.util.HashMap; |
19 |
|
import java.util.Hashtable; |
64 |
|
* that key reporting the updated value.) For aggregate operations |
65 |
|
* such as {@code putAll} and {@code clear}, concurrent retrievals may |
66 |
|
* reflect insertion or removal of only some entries. Similarly, |
67 |
< |
* Iterators and Enumerations return elements reflecting the state of |
68 |
< |
* the hash table at some point at or since the creation of the |
67 |
> |
* Iterators, Spliterators and Enumerations return elements reflecting the |
68 |
> |
* state of the hash table at some point at or since the creation of the |
69 |
|
* iterator/enumeration. They do <em>not</em> throw {@link |
70 |
< |
* ConcurrentModificationException}. However, iterators are designed |
71 |
< |
* to be used by only one thread at a time. Bear in mind that the |
72 |
< |
* results of aggregate status methods including {@code size}, {@code |
73 |
< |
* isEmpty}, and {@code containsValue} are typically useful only when |
74 |
< |
* a map is not undergoing concurrent updates in other threads. |
70 |
> |
* java.util.ConcurrentModificationException ConcurrentModificationException}. |
71 |
> |
* However, iterators are designed to be used by only one thread at a time. |
72 |
> |
* Bear in mind that the results of aggregate status methods including |
73 |
> |
* {@code size}, {@code isEmpty}, and {@code containsValue} are typically |
74 |
> |
* useful only when a map is not undergoing concurrent updates in other threads. |
75 |
|
* Otherwise the results of these methods reflect transient states |
76 |
|
* that may be adequate for monitoring or estimation purposes, but not |
77 |
|
* for program control. |
1170 |
|
* operations. It does not support the {@code add} or |
1171 |
|
* {@code addAll} operations. |
1172 |
|
* |
1173 |
< |
* <p>The view's {@code iterator} is a "weakly consistent" iterator |
1174 |
< |
* that will never throw {@link ConcurrentModificationException}, |
1175 |
< |
* and guarantees to traverse elements as they existed upon |
1176 |
< |
* construction of the iterator, and may (but is not guaranteed to) |
1173 |
> |
* <p>The view's iterators and spliterators are "weakly consistent": |
1174 |
> |
* they will never throw {@link java.util.ConcurrentModificationException |
1175 |
> |
* ConcurrentModificationException}; are guaranteed to traverse elements |
1176 |
> |
* as they existed upon construction; and may (but are not guaranteed to) |
1177 |
|
* reflect any modifications subsequent to construction. |
1178 |
|
* |
1179 |
+ |
* <p>The view's {@code spliterator} reports {@link Spliterator#CONCURRENT}, |
1180 |
+ |
* {@link Spliterator#DISTINCT}, and {@link Spliterator#NONNULL}. |
1181 |
+ |
* |
1182 |
|
* @return the set view |
1183 |
|
*/ |
1184 |
|
public KeySetView<K,V> keySet() { |
1196 |
|
* {@code retainAll}, and {@code clear} operations. It does not |
1197 |
|
* support the {@code add} or {@code addAll} operations. |
1198 |
|
* |
1199 |
< |
* <p>The view's {@code iterator} is a "weakly consistent" iterator |
1200 |
< |
* that will never throw {@link ConcurrentModificationException}, |
1201 |
< |
* and guarantees to traverse elements as they existed upon |
1202 |
< |
* construction of the iterator, and may (but is not guaranteed to) |
1199 |
> |
* <p>The view's iterators and spliterators are "weakly consistent": |
1200 |
> |
* they will never throw {@link java.util.ConcurrentModificationException |
1201 |
> |
* ConcurrentModificationException}; are guaranteed to traverse elements |
1202 |
> |
* as they existed upon construction; and may (but are not guaranteed to) |
1203 |
|
* reflect any modifications subsequent to construction. |
1204 |
|
* |
1205 |
+ |
* <p>The view's {@code spliterator} reports {@link Spliterator#CONCURRENT} |
1206 |
+ |
* and {@link Spliterator#NONNULL}. |
1207 |
+ |
* |
1208 |
|
* @return the collection view |
1209 |
|
*/ |
1210 |
|
public Collection<V> values() { |
1221 |
|
* {@code removeAll}, {@code retainAll}, and {@code clear} |
1222 |
|
* operations. |
1223 |
|
* |
1224 |
< |
* <p>The view's {@code iterator} is a "weakly consistent" iterator |
1225 |
< |
* that will never throw {@link ConcurrentModificationException}, |
1226 |
< |
* and guarantees to traverse elements as they existed upon |
1227 |
< |
* construction of the iterator, and may (but is not guaranteed to) |
1224 |
> |
* <p>The view's iterators and spliterators are "weakly consistent": |
1225 |
> |
* they will never throw {@link java.util.ConcurrentModificationException |
1226 |
> |
* ConcurrentModificationException}; are guaranteed to traverse elements |
1227 |
> |
* as they existed upon construction; and may (but are not guaranteed to) |
1228 |
|
* reflect any modifications subsequent to construction. |
1229 |
|
* |
1230 |
+ |
* <p>The view's {@code spliterator} reports {@link Spliterator#CONCURRENT}, |
1231 |
+ |
* {@link Spliterator#DISTINCT}, and {@link Spliterator#NONNULL}. |
1232 |
+ |
* |
1233 |
|
* @return the set view |
1234 |
|
*/ |
1235 |
|
public Set<Map.Entry<K,V>> entrySet() { |
4287 |
|
// implementations below rely on concrete classes supplying these |
4288 |
|
// abstract methods |
4289 |
|
/** |
4290 |
< |
* Returns a "weakly consistent" iterator that will never |
4291 |
< |
* throw {@link ConcurrentModificationException}, and |
4292 |
< |
* guarantees to traverse elements as they existed upon |
4293 |
< |
* construction of the iterator, and may (but is not |
4294 |
< |
* guaranteed to) reflect any modifications subsequent to |
4295 |
< |
* construction. |
4290 |
> |
* Returns a "weakly consistent" iterator that will never throw |
4291 |
> |
* {@link java.util.ConcurrentModificationException |
4292 |
> |
* ConcurrentModificationException}, and guarantees to traverse |
4293 |
> |
* elements as they existed upon construction of the iterator, |
4294 |
> |
* and may (but is not guaranteed to) reflect any modifications |
4295 |
> |
* subsequent to construction. |
4296 |
|
*/ |
4297 |
|
public abstract Iterator<E> iterator(); |
4298 |
|
public abstract boolean contains(Object o); |