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:
java.io.Serializable,java.lang.Iterable<K>,java.util.Collection<K>,java.util.Set<K>
- Enclosing class:
- ConcurrentHashMapV8<K,V>
public static class ConcurrentHashMapV8.KeySetView<K,V> extends ConcurrentHashMapV8.CollectionView<K,V,K> implements java.util.Set<K>, java.io.Serializable
A view of a ConcurrentHashMapV8 as aSetof keys, in which additions may optionally be enabled by mapping to a common value. This class cannot be directly instantiated. SeekeySet(),keySet(V),newKeySet(),newKeySet(int).- Since:
- 1.8
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDprivate Vvalue-
Fields inherited from class org.glassfish.jersey.internal.util.collection.ConcurrentHashMapV8.CollectionView
map
-
-
Constructor Summary
Constructors Constructor Description KeySetView(ConcurrentHashMapV8<K,V> map, V value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(K e)Adds the specified key to this set view by mapping the key to the default mapped value in the backing map, if defined.booleanaddAll(java.util.Collection<? extends K> c)Adds all of the elements in the specified collection to this set, as if by callingadd(K)on each one.booleancontains(java.lang.Object o)booleanequals(java.lang.Object o)VgetMappedValue()Returns the default mapped value for additions, ornullif additions are not supported.inthashCode()java.util.Iterator<K>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.booleanremove(java.lang.Object o)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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
value
private final V value
-
-
Constructor Detail
-
KeySetView
KeySetView(ConcurrentHashMapV8<K,V> map, V value)
-
-
Method Detail
-
getMappedValue
public V getMappedValue()
Returns the default mapped value for additions, ornullif additions are not supported.- Returns:
- the default mapped value for additions, or
nullif not supported
-
contains
public boolean contains(java.lang.Object o)
-
remove
public boolean remove(java.lang.Object o)
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:
removein interfacejava.util.Collection<K>- Specified by:
removein interfacejava.util.Set<K>- Specified by:
removein classConcurrentHashMapV8.CollectionView<K,V,K>- Parameters:
o- the key to be removed from the backing map- Returns:
trueif the backing map contained the specified key- Throws:
java.lang.NullPointerException- if the specified key is null
-
iterator
public java.util.Iterator<K> iterator()
Description copied from class:ConcurrentHashMapV8.CollectionViewReturns 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.- Specified by:
iteratorin interfacejava.util.Collection<K>- Specified by:
iteratorin interfacejava.lang.Iterable<K>- Specified by:
iteratorin interfacejava.util.Set<K>- Specified by:
iteratorin classConcurrentHashMapV8.CollectionView<K,V,K>- Returns:
- an iterator over the keys of the backing map
-
add
public boolean add(K e)
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:
addin interfacejava.util.Collection<K>- Specified by:
addin interfacejava.util.Set<K>- Parameters:
e- key to be added- Returns:
trueif this set changed as a result of the call- Throws:
java.lang.NullPointerException- if the specified key is nulljava.lang.UnsupportedOperationException- if no default mapped value for additions was provided
-
addAll
public boolean addAll(java.util.Collection<? extends K> c)
Adds all of the elements in the specified collection to this set, as if by callingadd(K)on each one.- Specified by:
addAllin interfacejava.util.Collection<K>- Specified by:
addAllin interfacejava.util.Set<K>- Parameters:
c- the elements to be inserted into this set- Returns:
trueif this set changed as a result of the call- Throws:
java.lang.NullPointerException- if the collection or any of its elements arenulljava.lang.UnsupportedOperationException- if no default mapped value for additions was provided
-
hashCode
public int hashCode()
-
-