|
GNU Trove | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gnu.trove.impl.hash.THash gnu.trove.impl.hash.TObjectHash<T> gnu.trove.impl.hash.TCustomObjectHash<E> gnu.trove.set.hash.TCustomHashSet<E>
public class TCustomHashSet<E>
An implementation of the Set interface that uses an open-addressed hash table to store its contents.
Field Summary |
---|
Fields inherited from class gnu.trove.impl.hash.TCustomObjectHash |
---|
strategy |
Fields inherited from class gnu.trove.impl.hash.TObjectHash |
---|
_set, consumeFreeSlot, FREE, REMOVED |
Fields inherited from class gnu.trove.impl.hash.THash |
---|
_autoCompactionFactor, _autoCompactRemovesRemaining, _autoCompactTemporaryDisable, _free, _loadFactor, _maxSize, _size, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR |
Constructor Summary | |
---|---|
TCustomHashSet()
FOR EXTERNALIZATION ONLY!!! |
|
TCustomHashSet(HashingStrategy<? super E> strategy)
Creates a new THashSet instance with the default
capacity and load factor. |
|
TCustomHashSet(HashingStrategy<? super E> strategy,
java.util.Collection<? extends E> collection)
Creates a new THashSet instance containing the
elements of collection. |
|
TCustomHashSet(HashingStrategy<? super E> strategy,
int initialCapacity)
Creates a new THashSet instance with a prime
capacity equal to or greater than initialCapacity and
with the default load factor. |
|
TCustomHashSet(HashingStrategy<? super E> strategy,
int initialCapacity,
float loadFactor)
Creates a new THashSet instance with a prime
capacity equal to or greater than initialCapacity and
with the specified load factor. |
Method Summary | ||
---|---|---|
boolean |
add(E obj)
Inserts a value into the set. |
|
boolean |
addAll(java.util.Collection<? extends E> collection)
Adds all of the elements in collection to the set. |
|
void |
clear()
Empties the set. |
|
boolean |
containsAll(java.util.Collection<?> collection)
Tests the set to determine if all of the elements in collection are present. |
|
boolean |
equals(java.lang.Object other)
|
|
int |
hashCode()
|
|
TObjectHashIterator<E> |
iterator()
Creates an iterator over the values of the set. |
|
void |
readExternal(java.io.ObjectInput in)
|
|
protected void |
rehash(int newCapacity)
Expands the set to accommodate new values. |
|
boolean |
remove(java.lang.Object obj)
Removes obj from the set. |
|
boolean |
removeAll(java.util.Collection<?> collection)
Removes all of the elements in collection from the set. |
|
boolean |
retainAll(java.util.Collection<?> collection)
Removes any values in the set which are not contained in collection. |
|
java.lang.Object[] |
toArray()
Returns a new array containing the objects in the set. |
|
|
toArray(T[] a)
Returns a typed array of the objects in the set. |
|
java.lang.String |
toString()
|
|
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class gnu.trove.impl.hash.TCustomObjectHash |
---|
equals, hash |
Methods inherited from class gnu.trove.impl.hash.TObjectHash |
---|
buildObjectContractViolation, capacity, contains, dumpExtraInfo, forEach, index, insertionIndex, insertKey, objectInfo, removeAt, reportPotentialConcurrentMod, setUp, throwObjectContractViolation, throwObjectContractViolation |
Methods inherited from class gnu.trove.impl.hash.THash |
---|
calculateGrownCapacity, compact, computeMaxSize, computeNextAutoCompactionAmount, ensureCapacity, getAutoCompactionFactor, isEmpty, postInsertHook, reenableAutoCompaction, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSize |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
contains, isEmpty, size |
Constructor Detail |
---|
public TCustomHashSet()
public TCustomHashSet(HashingStrategy<? super E> strategy)
THashSet
instance with the default
capacity and load factor.
public TCustomHashSet(HashingStrategy<? super E> strategy, int initialCapacity)
THashSet
instance with a prime
capacity equal to or greater than initialCapacity and
with the default load factor.
initialCapacity
- an int
valuepublic TCustomHashSet(HashingStrategy<? super E> strategy, int initialCapacity, float loadFactor)
THashSet
instance with a prime
capacity equal to or greater than initialCapacity and
with the specified load factor.
initialCapacity
- an int
valueloadFactor
- a float
valuepublic TCustomHashSet(HashingStrategy<? super E> strategy, java.util.Collection<? extends E> collection)
THashSet
instance containing the
elements of collection.
collection
- a Collection
valueMethod Detail |
---|
public boolean add(E obj)
add
in interface java.util.Collection<E>
add
in interface java.util.Set<E>
obj
- an Object
value
public boolean equals(java.lang.Object other)
equals
in interface java.util.Collection<E>
equals
in interface java.util.Set<E>
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface java.util.Collection<E>
hashCode
in interface java.util.Set<E>
hashCode
in class java.lang.Object
protected void rehash(int newCapacity)
rehash
in class gnu.trove.impl.hash.THash
newCapacity
- an int
valuepublic java.lang.Object[] toArray()
toArray
in interface java.util.Collection<E>
toArray
in interface java.util.Set<E>
Object[]
valuepublic <T> T[] toArray(T[] a)
toArray
in interface java.util.Collection<E>
toArray
in interface java.util.Set<E>
a
- an Object[]
value
Object[]
valuepublic void clear()
clear
in interface java.util.Collection<E>
clear
in interface java.util.Set<E>
clear
in class gnu.trove.impl.hash.THash
public boolean remove(java.lang.Object obj)
remove
in interface java.util.Collection<E>
remove
in interface java.util.Set<E>
obj
- an Object
value
public TObjectHashIterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
iterator
in interface java.util.Collection<E>
iterator
in interface java.util.Set<E>
Iterator
valuepublic boolean containsAll(java.util.Collection<?> collection)
containsAll
in interface java.util.Collection<E>
containsAll
in interface java.util.Set<E>
collection
- a Collection
value
public boolean addAll(java.util.Collection<? extends E> collection)
addAll
in interface java.util.Collection<E>
addAll
in interface java.util.Set<E>
collection
- a Collection
value
public boolean removeAll(java.util.Collection<?> collection)
removeAll
in interface java.util.Collection<E>
removeAll
in interface java.util.Set<E>
collection
- a Collection
value
public boolean retainAll(java.util.Collection<?> collection)
retainAll
in interface java.util.Collection<E>
retainAll
in interface java.util.Set<E>
collection
- a Collection
value
public java.lang.String toString()
toString
in class java.lang.Object
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class gnu.trove.impl.hash.TCustomObjectHash<E>
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class gnu.trove.impl.hash.TCustomObjectHash<E>
java.io.IOException
java.lang.ClassNotFoundException
|
GNU Trove | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |