GeezerVison is showing docs.oracle.com — ConcurrentHashMap.KeySetView (Java SE 9 & JDK 9 )
Class ConcurrentHashMap.KeySetView<K,V>
-
-
Method Summary
All Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
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.
|
boolean |
addAll(Collection<? extends K> c) |
Adds all of the elements in the specified collection to this set,
as if by calling add(K) on each one.
|
void |
clear() |
Removes all of the elements from this view, by removing all
the mappings from the map backing this view.
|
boolean |
contains(Object o) |
Returns true if this collection contains the specified element.
|
boolean |
containsAll(Collection<?> c) |
Returns true if this collection contains all of the elements
in the specified collection.
|
boolean |
equals(Object o) |
Indicates whether some other object is "equal to" this one.
|
void |
forEach(Consumer<? super K> action) |
Performs the given action for each element of the Iterable
until all elements have been processed or the action throws an
exception.
|
ConcurrentHashMap<K,V> |
getMap() |
Returns the map backing this view.
|
V |
getMappedValue() |
Returns the default mapped value for additions,
or null if additions are not supported.
|
int |
hashCode() |
Returns a hash code value for the object.
|
boolean |
isEmpty() |
Returns true if this collection contains no elements.
|
Iterator<K> |
iterator() |
Returns an iterator over the elements in this collection.
|
boolean |
remove(Object o) |
Removes the key from this map view, by removing the key (and its
corresponding value) from the backing map.
|
boolean |
removeAll(Collection<?> c) |
Removes all of this collection's elements that are also contained in the
specified collection (optional operation).
|
boolean |
retainAll(Collection<?> c) |
Retains only the elements in this collection that are contained in the
specified collection (optional operation).
|
int |
size() |
Returns the number of elements in this collection.
|
Spliterator<K> |
spliterator() |
Creates a Spliterator over the elements in this set.
|
Object[] |
toArray() |
Returns an array containing all of the elements in this collection.
|
<T> T[] |
toArray(T[] a) |
Returns an array containing all of the elements in this collection;
the runtime type of the returned array is that of the specified array.
|
String |
toString() |
Returns a string representation of this collection.
|
-
Methods inherited from interface java.util.Set
clear, containsAll, isEmpty, of, of, of, of, of, of, of, of, of, of, of, of, removeAll, retainAll, size, toArray, toArray
-
-
Method Detail
-
getMappedValue
public V getMappedValue()
Returns the default mapped value for additions,
or null if additions are not supported.
- Returns:
- the default mapped value for additions, or
null
if not supported
-
contains
public boolean contains(Object o)
Returns true if this collection contains the specified element.
More formally, returns true if and only if this collection
contains at least one element e such that
Objects.equals(o, e).
- Specified by:
contains in interface Collection<K>
- Specified by:
contains in interface Set<K>
- Parameters:
o - element whose presence in this collection is to be tested
- Returns:
true if this collection contains the specified
element
- Throws:
NullPointerException - if the specified key is null
-
remove
public boolean remove(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:
remove in interface Collection<K>
- Specified by:
remove in interface Set<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
-
hashCode
public int hashCode()
Description copied from class: Object
Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
HashMap.
The general contract of hashCode is:
- Whenever it is invoked on the same object more than once during
an execution of a Java application, the
hashCode method
must consistently return the same integer, provided no information
used in equals comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
- If two objects are equal according to the
equals(Object)
method, then calling the hashCode method on each of
the two objects must produce the same integer result.
- It is not required that if two objects are unequal
according to the
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined
by class Object does return distinct integers for
distinct objects. (The hashCode may or may not be implemented
as some function of an object's memory address at some point
in time.)
- Specified by:
hashCode in interface Collection<K>
- Specified by:
hashCode in interface Set<K>
- Overrides:
hashCode in class Object
- Returns:
- a hash code value for this object.
- See Also:
Object.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)
-
clear
public final void clear()
Removes all of the elements from this view, by removing all
the mappings from the map backing this view.
- Specified by:
clear in interface Collection<K>
-
removeAll
public boolean removeAll(Collection<?> c)
Removes all of this collection's elements that are also contained in the
specified collection (optional operation). After this call returns,
this collection will contain no elements in common with the specified
collection.
- Specified by:
removeAll in interface Collection<K>
- Parameters:
c - collection containing elements to be removed from this collection
- Returns:
true if this collection changed as a result of the
call
- See Also:
Collection.remove(Object),
Collection.contains(Object)
-
retainAll
public final boolean retainAll(Collection<?> c)
Retains only the elements in this collection that are contained in the
specified collection (optional operation). In other words, removes from
this collection all of its elements that are not contained in the
specified collection.
- Specified by:
retainAll in interface Collection<K>
- Parameters:
c - collection containing elements to be retained in this collection
- Returns:
true if this collection changed as a result of the call
- See Also:
Collection.remove(Object),
Collection.contains(Object)
|