Package gnu.trove.set.hash
Class TLinkedHashSet<E>
- java.lang.Object
-
- gnu.trove.impl.hash.THash
-
- gnu.trove.impl.hash.TObjectHash<E>
-
- gnu.trove.set.hash.THashSet<E>
-
- gnu.trove.set.hash.TLinkedHashSet<E>
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,java.lang.Iterable<E>,java.util.Collection<E>,java.util.Set<E>
public class TLinkedHashSet<E> extends gnu.trove.set.hash.THashSet<E>Created by IntelliJ IDEA. User: Johan Date: 15/03/11 Time: 18:15 To change this template use File | Settings | File Templates.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TLinkedHashSet()Creates a newTHashSetinstance with the default capacity and load factor.TLinkedHashSet(int initialCapacity)Creates a newTHashSetinstance with a prime capacity equal to or greater than initialCapacity and with the default load factor.TLinkedHashSet(int initialCapacity, float loadFactor)Creates a newTHashSetinstance with a prime capacity equal to or greater than initialCapacity and with the specified load factor.TLinkedHashSet(java.util.Collection<? extends E> es)Creates a newTHashSetinstance containing the elements of collection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E obj)Inserts a value into the set.voidclear()Empties the set.booleanforEach(gnu.trove.procedure.TObjectProcedure<? super E> procedure)Executes procedure for each element in the set.gnu.trove.iterator.hash.TObjectHashIterator<E>iterator()Creates an iterator over the values of the set.protected voidrehash(int newCapacity)Expands the set to accommodate new values.protected voidremoveAt(int index)intsetUp(int initialCapacity)initializes the Object set of this hash table.java.lang.StringtoString()protected voidwriteEntries(java.io.ObjectOutput out)-
Methods inherited from class gnu.trove.set.hash.THashSet
addAll, containsAll, equals, hashCode, readExternal, remove, removeAll, retainAll, toArray, toArray, writeExternal
-
Methods inherited from class gnu.trove.impl.hash.TObjectHash
buildObjectContractViolation, capacity, contains, dumpExtraInfo, equals, hash, index, insertionIndex, insertKey, objectInfo, reportPotentialConcurrentMod, throwObjectContractViolation, throwObjectContractViolation
-
Methods inherited from class gnu.trove.impl.hash.THash
calculateGrownCapacity, compact, computeMaxSize, computeNextAutoCompactionAmount, ensureCapacity, fastCeil, getAutoCompactionFactor, isEmpty, postInsertHook, reenableAutoCompaction, saturatedCast, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSize
-
-
-
-
Constructor Detail
-
TLinkedHashSet
public TLinkedHashSet()
Creates a newTHashSetinstance with the default capacity and load factor.
-
TLinkedHashSet
public TLinkedHashSet(int initialCapacity)
Creates a newTHashSetinstance with a prime capacity equal to or greater than initialCapacity and with the default load factor.- Parameters:
initialCapacity- anintvalue
-
TLinkedHashSet
public TLinkedHashSet(int initialCapacity, float loadFactor)Creates a newTHashSetinstance with a prime capacity equal to or greater than initialCapacity and with the specified load factor.- Parameters:
initialCapacity- anintvalueloadFactor- afloatvalue
-
TLinkedHashSet
public TLinkedHashSet(java.util.Collection<? extends E> es)
Creates a newTHashSetinstance containing the elements of collection.- Parameters:
es- aCollectionvalue
-
-
Method Detail
-
setUp
public int setUp(int initialCapacity)
initializes the Object set of this hash table.- Overrides:
setUpin classgnu.trove.impl.hash.TObjectHash<E>- Parameters:
initialCapacity- anintvalue- Returns:
- an
intvalue
-
clear
public void clear()
Empties the set.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classgnu.trove.set.hash.THashSet<E>
-
add
public boolean add(E obj)
Inserts a value into the set.
-
removeAt
protected void removeAt(int index)
- Overrides:
removeAtin classgnu.trove.impl.hash.TObjectHash<E>
-
rehash
protected void rehash(int newCapacity)
Expands the set to accommodate new values.- Overrides:
rehashin classgnu.trove.set.hash.THashSet<E>- Parameters:
newCapacity- anintvalue
-
writeEntries
protected void writeEntries(java.io.ObjectOutput out) throws java.io.IOException- Overrides:
writeEntriesin classgnu.trove.set.hash.THashSet<E>- Throws:
java.io.IOException
-
iterator
public gnu.trove.iterator.hash.TObjectHashIterator<E> iterator()
Creates an iterator over the values of the set. The iterator supports element deletion.
-
forEach
public boolean forEach(gnu.trove.procedure.TObjectProcedure<? super E> procedure)
Executes procedure for each element in the set.- Overrides:
forEachin classgnu.trove.impl.hash.TObjectHash<E>- Parameters:
procedure- aTObjectProcedurevalue- Returns:
- false if the loop over the set terminated because the procedure returned false for some value.
-
-