Class ConcurrentHashMapV8.KeySetView<K,V>
java.lang.Object
org.glassfish.jersey.internal.util.collection.ConcurrentHashMapV8.CollectionView<K,V,K>
org.glassfish.jersey.internal.util.collection.ConcurrentHashMapV8.KeySetView<K,V>
- All Implemented Interfaces:
Serializable
,Iterable<K>
,Collection<K>
,Set<K>
- Enclosing class:
ConcurrentHashMapV8<K,
V>
public static class ConcurrentHashMapV8.KeySetView<K,V>
extends ConcurrentHashMapV8.CollectionView<K,V,K>
implements Set<K>, Serializable
A view of a ConcurrentHashMapV8 as a
Set
of keys, in
which additions may optionally be enabled by mapping to a
common value. This class cannot be directly instantiated.
See keySet()
,
keySet(V)
,
newKeySet()
,
newKeySet(int)
.- Since:
- 1.8
- See Also:
-
Field Summary
FieldsFields inherited from class org.glassfish.jersey.internal.util.collection.ConcurrentHashMapV8.CollectionView
map
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds the specified key to this set view by mapping the key to the default mapped value in the backing map, if defined.boolean
addAll
(Collection<? extends K> c) Adds all of the elements in the specified collection to this set, as if by callingadd(K)
on each one.boolean
boolean
Returns the default mapped value for additions, ornull
if additions are not supported.int
hashCode()
iterator()
Returns a "weakly consistent" iterator that will never throwConcurrentModificationException
, and guarantees to traverse elements as they existed upon construction of the iterator, and may (but is not guaranteed to) reflect any modifications subsequent to construction.boolean
Removes the key from this map view, by removing the key (and its corresponding value) from the backing map.Methods inherited from class org.glassfish.jersey.internal.util.collection.ConcurrentHashMapV8.CollectionView
clear, containsAll, getMap, isEmpty, removeAll, retainAll, size, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
clear, containsAll, isEmpty, removeAll, retainAll, size, spliterator, toArray, toArray
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
value
-
-
Constructor Details
-
KeySetView
KeySetView(ConcurrentHashMapV8<K, V> map, V value)
-
-
Method Details
-
getMappedValue
Returns the default mapped value for additions, ornull
if additions are not supported.- Returns:
- the default mapped value for additions, or
null
if not supported
-
contains
- Specified by:
contains
in interfaceCollection<K>
- Specified by:
contains
in interfaceSet<K>
- Specified by:
contains
in classConcurrentHashMapV8.CollectionView<K,
V, K> - Throws:
NullPointerException
- if the specified key is null
-
remove
Removes the key from this map view, by removing the key (and its corresponding value) from the backing map. This method does nothing if the key is not in the map.- Specified by:
remove
in interfaceCollection<K>
- Specified by:
remove
in interfaceSet<K>
- Specified by:
remove
in classConcurrentHashMapV8.CollectionView<K,
V, K> - Parameters:
o
- the key to be removed from the backing map- Returns:
true
if the backing map contained the specified key- Throws:
NullPointerException
- if the specified key is null
-
iterator
Description copied from class:ConcurrentHashMapV8.CollectionView
Returns a "weakly consistent" iterator that will never throwConcurrentModificationException
, and guarantees to traverse elements as they existed upon construction of the iterator, and may (but is not guaranteed to) reflect any modifications subsequent to construction. -
add
Adds the specified key to this set view by mapping the key to the default mapped value in the backing map, if defined.- Specified by:
add
in interfaceCollection<K>
- Specified by:
add
in interfaceSet<K>
- Parameters:
e
- key to be added- Returns:
true
if this set changed as a result of the call- Throws:
NullPointerException
- if the specified key is nullUnsupportedOperationException
- if no default mapped value for additions was provided
-
addAll
Adds all of the elements in the specified collection to this set, as if by callingadd(K)
on each one.- Specified by:
addAll
in interfaceCollection<K>
- Specified by:
addAll
in interfaceSet<K>
- Parameters:
c
- the elements to be inserted into this set- Returns:
true
if this set changed as a result of the call- Throws:
NullPointerException
- if the collection or any of its elements arenull
UnsupportedOperationException
- if no default mapped value for additions was provided
-
hashCode
public int hashCode() -
equals
-