public static class CustomConcurrentHashMap.KeySet extends java.util.AbstractSet
A hash-based set with properties identical to those of
Collections.newSetFromMap
applied to a
CustomConcurrentHashMap
, but possibly more
space-efficient. The set does not permit null elements. The
set is serializable; however, serializing a set that uses soft
or weak references can give unpredictable results.
Modifiers | Name | Description |
---|---|---|
CustomConcurrentHashMap<K, K> |
cchm |
Constructor and description |
---|
CustomConcurrentHashMap.KeySet
(Strength strength, Equivalence<? super K> equivalence, int expectedSize) Creates a set with the given parameters. |
Type | Name and description |
---|---|
boolean |
add(K e) Adds the specified element to this set if there is not already an element equivalent to the given element with respect to this set's Equivalence. |
void |
clear() Removes all of the elements from this set. |
boolean |
contains(java.lang.Object o) Returns true if this set contains an
element equivalent to the given element with respect
to this set's Equivalence. |
int |
hashCode() Returns the sum of the hash codes of each element, as computed by this set's Equivalence. |
K |
intern(K e) Returns an element equivalent to the given element with respect to this set's Equivalence, if such an element exists, else adds and returns the given element. |
boolean |
isEmpty() Returns true if this set contains no elements. |
java.util.Iterator<K> |
iterator() Returns a weakly consistent iterator over the elements in this set, that may reflect some, all or none of the changes made to the set after the iterator was created. |
boolean |
remove(java.lang.Object o) Removes an element equivalent to the given element with respect to this set's Equivalence, if one is present. |
int |
size() Returns the number of elements in this set (its cardinality). |
Methods inherited from class | Name |
---|---|
class java.util.AbstractSet |
java.util.AbstractSet#equals(java.lang.Object), java.util.AbstractSet#hashCode(), java.util.AbstractSet#removeAll(java.util.Collection), java.util.AbstractSet#add(java.lang.Object), java.util.AbstractSet#remove(java.lang.Object), java.util.AbstractSet#toString(), java.util.AbstractSet#clear(), java.util.AbstractSet#contains(java.lang.Object), java.util.AbstractSet#isEmpty(), java.util.AbstractSet#iterator(), java.util.AbstractSet#size(), java.util.AbstractSet#toArray(), java.util.AbstractSet#toArray([Ljava.lang.Object;), java.util.AbstractSet#addAll(java.util.Collection), java.util.AbstractSet#containsAll(java.util.Collection), java.util.AbstractSet#retainAll(java.util.Collection), java.util.AbstractSet#wait(), java.util.AbstractSet#wait(long, int), java.util.AbstractSet#wait(long), java.util.AbstractSet#getClass(), java.util.AbstractSet#notify(), java.util.AbstractSet#notifyAll(), java.util.AbstractSet#stream(), java.util.AbstractSet#removeIf(java.util.function.Predicate), java.util.AbstractSet#parallelStream(), java.util.AbstractSet#forEach(java.util.function.Consumer), java.util.AbstractSet#iterator(), java.util.AbstractSet#size(), java.util.AbstractSet#spliterator() |
class java.util.AbstractCollection |
java.util.AbstractCollection#add(java.lang.Object), java.util.AbstractCollection#remove(java.lang.Object), java.util.AbstractCollection#toString(), java.util.AbstractCollection#clear(), java.util.AbstractCollection#contains(java.lang.Object), java.util.AbstractCollection#isEmpty(), java.util.AbstractCollection#iterator(), java.util.AbstractCollection#size(), java.util.AbstractCollection#toArray(), java.util.AbstractCollection#toArray([Ljava.lang.Object;), java.util.AbstractCollection#addAll(java.util.Collection), java.util.AbstractCollection#containsAll(java.util.Collection), java.util.AbstractCollection#removeAll(java.util.Collection), java.util.AbstractCollection#retainAll(java.util.Collection), java.util.AbstractCollection#wait(), java.util.AbstractCollection#wait(long, int), java.util.AbstractCollection#wait(long), java.util.AbstractCollection#equals(java.lang.Object), java.util.AbstractCollection#hashCode(), java.util.AbstractCollection#getClass(), java.util.AbstractCollection#notify(), java.util.AbstractCollection#notifyAll(), java.util.AbstractCollection#spliterator(), java.util.AbstractCollection#stream(), java.util.AbstractCollection#removeIf(java.util.function.Predicate), java.util.AbstractCollection#parallelStream(), java.util.AbstractCollection#forEach(java.util.function.Consumer) |
Creates a set with the given parameters.
strength
- the strength of elementsequivalence
- the Equivalence to useexpectedSize
- an estimate of the number of elements
that will be held in the set. If no estimate is known, zero
is an acceptable value.Adds the specified element to this set if there is not already an element equivalent to the given element with respect to this set's Equivalence.
true
if this set did not already contain
the specified elemente
- element to be added to this setRemoves all of the elements from this set.
Returns true
if this set contains an
element equivalent to the given element with respect
to this set's Equivalence.
true
if this set contains the specified elemento
- element whose presence in this set is to be testedReturns the sum of the hash codes of each element, as computed by this set's Equivalence.
Returns an element equivalent to the given element with respect to this set's Equivalence, if such an element exists, else adds and returns the given element.
e
- the element Returns true
if this set contains no elements.
true
if this set contains no elementsReturns a weakly consistent iterator over the elements in this set, that may reflect some, all or none of the changes made to the set after the iterator was created.
Removes an element equivalent to the given element with respect to this set's Equivalence, if one is present.
true
if the set contained the specified elemento
- object to be removed from this set, if presentReturns the number of elements in this set (its cardinality).
Copyright © 2008–2014 Václav Pech. All Rights Reserved.