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:
Externalizable
,Serializable
,Iterable<E>
,Collection<E>
,Set<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:
-
Field Summary
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
ConstructorsConstructorDescriptionCreates a newTHashSet
instance with the default capacity and load factor.TLinkedHashSet
(int initialCapacity) Creates a newTHashSet
instance with a prime capacity equal to or greater than initialCapacity and with the default load factor.TLinkedHashSet
(int initialCapacity, float loadFactor) Creates a newTHashSet
instance with a prime capacity equal to or greater than initialCapacity and with the specified load factor.TLinkedHashSet
(Collection<? extends E> es) Creates a newTHashSet
instance containing the elements of collection. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Inserts a value into the set.void
clear()
Empties the set.boolean
forEach
(TObjectProcedure<? super E> procedure) Executes procedure for each element in the set.iterator()
Creates an iterator over the values of the set.protected void
rehash
(int newCapacity) Expands the set to accommodate new values.protected void
removeAt
(int index) Delete the record at index.int
setUp
(int initialCapacity) initializes the Object set of this hash table.toString()
protected void
writeEntries
(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, 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.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
contains, isEmpty, size, spliterator
-
Constructor Details
-
TLinkedHashSet
public TLinkedHashSet()Creates a newTHashSet
instance with the default capacity and load factor. -
TLinkedHashSet
public TLinkedHashSet(int initialCapacity) Creates a newTHashSet
instance with a prime capacity equal to or greater than initialCapacity and with the default load factor.- Parameters:
initialCapacity
- anint
value
-
TLinkedHashSet
public TLinkedHashSet(int initialCapacity, float loadFactor) Creates a newTHashSet
instance with a prime capacity equal to or greater than initialCapacity and with the specified load factor.- Parameters:
initialCapacity
- anint
valueloadFactor
- afloat
value
-
TLinkedHashSet
Creates a newTHashSet
instance containing the elements of collection.- Parameters:
es
- aCollection
value
-
-
Method Details
-
setUp
public int setUp(int initialCapacity) initializes the Object set of this hash table.- Overrides:
setUp
in classgnu.trove.impl.hash.TObjectHash<E>
- Parameters:
initialCapacity
- anint
value- Returns:
- an
int
value
-
clear
public void clear()Empties the set. -
toString
-
add
Inserts a value into the set. -
removeAt
protected void removeAt(int index) Description copied from class:gnu.trove.impl.hash.THash
Delete the record at index. Reduces the size of the collection by one.- Overrides:
removeAt
in classgnu.trove.impl.hash.TObjectHash<E>
- Parameters:
index
- anint
value
-
rehash
protected void rehash(int newCapacity) Expands the set to accommodate new values. -
writeEntries
- Overrides:
writeEntries
in classTHashSet<E>
- Throws:
IOException
-
iterator
Creates an iterator over the values of the set. The iterator supports element deletion. -
forEach
Executes procedure for each element in the set.- Overrides:
forEach
in classgnu.trove.impl.hash.TObjectHash<E>
- Parameters:
procedure
- aTObjectProcedure
value- Returns:
- false if the loop over the set terminated because the procedure returned false for some value.
-