T - the type of elements maintained by this setpublic class ConcurrentTHashSet<T> extends com.gemstone.gemfire.internal.concurrent.THashParameters implements Set<T>
THashSet.| Modifier and Type | Class and Description |
|---|---|
class |
ConcurrentTHashSet.Itr |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CONCURRENCY |
protected int |
numSegments |
protected com.gemstone.gemfire.internal.concurrent.ConcurrentTHashSegment<T>[] |
segments |
| Constructor and Description |
|---|
ConcurrentTHashSet() |
ConcurrentTHashSet(int concurrency) |
ConcurrentTHashSet(int concurrency,
int initialCapacity,
float loadFactor,
com.gemstone.gnu.trove.TObjectHashingStrategy strategy,
com.gemstone.gnu.trove.HashingStats stats) |
ConcurrentTHashSet(com.gemstone.gnu.trove.TObjectHashingStrategy strategy) |
ConcurrentTHashSet(com.gemstone.gnu.trove.TObjectHashingStrategy strategy,
com.gemstone.gnu.trove.HashingStats stats) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T e) |
boolean |
addAll(Collection<? extends T> c) |
Object |
addKey(T e)
Like
add(Object) but returns the current key if already present in
set (instead of false) else null (instead of true). |
boolean |
bulkRemoveAll(Collection<?> c)
Like
removeAll(Collection) but optimized for large size of
collection to minimize lock acquire/release and duration of locking. |
long |
capacity() |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
<K,C,P> T |
create(K key,
com.gemstone.gemfire.internal.concurrent.MapCallback<K,T,C,P> valueCreator,
C context,
P createParams)
Like
add(T) but creates the value only if none present rather than
requiring a passed in pre-created object that may ultimately be thrown
away. |
long |
estimateMemoryOverhead(SingleObjectSizer sizer) |
boolean |
forEach(com.gemstone.gnu.trove.TObjectProcedure proc)
Apply the given procedure for each element of the set.
|
T |
get(Object o)
Get the value in the set lookup up against given object, or null if not
present.
|
T |
getUnsafe(Object o)
Like
get(Object) but skips acquiring any locks.No product code
should use this except for monitoring or other such purposes which should
not wait for locks and is not affected much by inaccurate results. |
boolean |
isEmpty() |
ConcurrentTHashSet.Itr |
iterator() |
void |
lockAllSegmentsForRead() |
long |
longSize() |
Object |
put(T e)
Like
addKey(Object) but replaces the current key if present. |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
T |
removeKey(Object o)
Like
remove(Object) but returns the current key if present in set
and removed (instead of true) else null (instead of false). |
boolean |
replace(Object o,
T e)
Replace an old value with new value.
|
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<E> E[] |
toArray(E[] a) |
<E,C> E[] |
toArray(E[] a,
com.gemstone.gemfire.internal.concurrent.MapCallback<?,T,C,?> callback,
C context) |
<E> void |
toCollectionUnsafe(Collection<E> result)
This variant of toArray is an unsafe one that takes no segment locks and
can return somewhat arbitrary results.
|
com.gemstone.gnu.trove.THashSet |
toSet()
This is a variant of toArray to send back the result as a set.
|
String |
toString() |
void |
unlockAllSegmentsAfterRead() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, hashCode, spliteratorparallelStream, removeIf, streampublic static final int DEFAULT_CONCURRENCY
protected final com.gemstone.gemfire.internal.concurrent.ConcurrentTHashSegment<T>[] segments
protected final int numSegments
public ConcurrentTHashSet()
public ConcurrentTHashSet(com.gemstone.gnu.trove.TObjectHashingStrategy strategy)
public ConcurrentTHashSet(int concurrency)
public ConcurrentTHashSet(com.gemstone.gnu.trove.TObjectHashingStrategy strategy,
com.gemstone.gnu.trove.HashingStats stats)
public ConcurrentTHashSet(int concurrency,
int initialCapacity,
float loadFactor,
com.gemstone.gnu.trove.TObjectHashingStrategy strategy,
com.gemstone.gnu.trove.HashingStats stats)
public final long longSize()
public final int size()
public final long capacity()
public final boolean isEmpty()
public final boolean contains(Object o)
public final T get(Object o)
contains(Object) in that depending
on TObjectHashingStrategy the lookup object may not be identical to
the object in set.public final T getUnsafe(Object o)
get(Object) but skips acquiring any locks.No product code
should use this except for monitoring or other such purposes which should
not wait for locks and is not affected much by inaccurate results.public final boolean add(T e)
public final Object addKey(T e)
add(Object) but returns the current key if already present in
set (instead of false) else null (instead of true).public final Object put(T e)
addKey(Object) but replaces the current key if present.public final <K,C,P> T create(K key, com.gemstone.gemfire.internal.concurrent.MapCallback<K,T,C,P> valueCreator, C context, P createParams)
add(T) but creates the value only if none present rather than
requiring a passed in pre-created object that may ultimately be thrown
away.key - key which is to be looked up in the setvalueCreator - factory object to create the value to be inserted into the set, if
requiredcontext - the context in which this method has been invoked and passed to
valueCreator MapCallback.newValue(K, C, P, com.gemstone.gemfire.internal.concurrent.MapResult) method to
create the new instancecreateParams - parameters to be passed to the valueCreator
MapCallback.newValue(K, C, P, com.gemstone.gemfire.internal.concurrent.MapResult) method to create the new instanceMapCallback.newValue(K, C, P, com.gemstone.gemfire.internal.concurrent.MapResult) if
there was no mapping for the key, or null if
MapCallback.newValue(K, C, P, com.gemstone.gemfire.internal.concurrent.MapResult) invoked
ConcurrentTHashSegment.setNewValueCreated(boolean) to false from
within its bodyNullPointerException - if the specified key or value is nullpublic final boolean remove(Object o)
public final T removeKey(Object o)
remove(Object) but returns the current key if present in set
and removed (instead of true) else null (instead of false).public final boolean replace(Object o, T e)
o - the old value to be replacede - the new value to be insertedpublic final boolean containsAll(Collection<?> c)
containsAll in interface Collection<T>containsAll in interface Set<T>public final boolean addAll(Collection<? extends T> c)
public final boolean retainAll(Collection<?> c)
public final boolean removeAll(Collection<?> c)
public final boolean bulkRemoveAll(Collection<?> c)
removeAll(Collection) but optimized for large size of
collection to minimize lock acquire/release and duration of locking.
Usually you will want to use this when size of collection is greater than
the concurreny level of the map.public void clear()
public final ConcurrentTHashSet.Itr iterator()
public void lockAllSegmentsForRead()
public void unlockAllSegmentsAfterRead()
public final boolean forEach(com.gemstone.gnu.trove.TObjectProcedure proc)
public Object[] toArray()
public <E,C> E[] toArray(E[] a,
com.gemstone.gemfire.internal.concurrent.MapCallback<?,T,C,?> callback,
C context)
public <E> E[] toArray(E[] a)
public com.gemstone.gnu.trove.THashSet toSet()
public <E> void toCollectionUnsafe(Collection<E> result)
public long estimateMemoryOverhead(SingleObjectSizer sizer)
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.