java.io.Externalizable
, java.io.Serializable
, java.lang.Iterable<E>
, java.util.Collection<E>
, java.util.Set<E>
TLinkedHashSet
public class THashSet<E>
extends gnu.trove.impl.hash.TObjectHash<E>
implements java.util.Set<E>, java.lang.Iterable<E>, java.io.Externalizable
Constructor | Description |
---|---|
THashSet() |
Creates a new
THashSet instance with the default
capacity and load factor. |
THashSet(int initialCapacity) |
Creates a new
THashSet instance with a prime
capacity equal to or greater than initialCapacity and
with the default load factor. |
THashSet(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. |
THashSet(java.util.Collection<? extends E> collection) |
Creates a new
THashSet instance containing the
elements of collection. |
Modifier and Type | Method | Description |
---|---|---|
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.
|
<T> T[] |
toArray(T[] a) |
Returns a typed array of the objects in the set.
|
java.lang.String |
toString() |
|
protected void |
writeEntries(java.io.ObjectOutput out) |
|
void |
writeExternal(java.io.ObjectOutput out) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
contains, isEmpty, of, of, of, of, of, of, of, of, of, of, of, of, size, spliterator
calculateGrownCapacity, compact, computeMaxSize, computeNextAutoCompactionAmount, ensureCapacity, getAutoCompactionFactor, isEmpty, postInsertHook, reenableAutoCompaction, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSize
buildObjectContractViolation, capacity, contains, dumpExtraInfo, equals, forEach, hash, index, insertionIndex, insertKey, objectInfo, removeAt, reportPotentialConcurrentMod, setUp, throwObjectContractViolation, throwObjectContractViolation
public THashSet()
THashSet
instance with the default
capacity and load factor.public THashSet(int initialCapacity)
THashSet
instance with a prime
capacity equal to or greater than initialCapacity and
with the default load factor.initialCapacity
- an int
valuepublic THashSet(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 THashSet(java.util.Collection<? extends E> collection)
THashSet
instance containing the
elements of collection.collection
- a Collection
valuepublic boolean add(E obj)
public boolean equals(java.lang.Object other)
public int hashCode()
protected void rehash(int newCapacity)
rehash
in class gnu.trove.impl.hash.THash
newCapacity
- an int
valuepublic java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public void clear()
public boolean remove(java.lang.Object obj)
public TObjectHashIterator<E> iterator()
public boolean containsAll(java.util.Collection<?> collection)
public boolean addAll(java.util.Collection<? extends E> collection)
public boolean removeAll(java.util.Collection<?> collection)
public boolean retainAll(java.util.Collection<?> collection)
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.TObjectHash<E>
java.io.IOException
protected void writeEntries(java.io.ObjectOutput out) throws java.io.IOException
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.TObjectHash<E>
java.io.IOException
java.lang.ClassNotFoundException