GNU Trove

gnu.trove.set.hash
Class TLinkedHashSet<E>

java.lang.Object
  extended by gnu.trove.impl.hash.THash
      extended by gnu.trove.impl.hash.TObjectHash<E>
          extended by gnu.trove.set.hash.THashSet<E>
              extended by 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 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

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
TLinkedHashSet()
          Creates a new THashSet instance with the default capacity and load factor.
TLinkedHashSet(java.util.Collection<? extends E> es)
          Creates a new THashSet instance containing the elements of collection.
TLinkedHashSet(int initialCapacity)
          Creates a new THashSet instance with a prime capacity equal to or greater than initialCapacity and with the default load factor.
TLinkedHashSet(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.
 void clear()
          Empties the set.
 boolean forEach(TObjectProcedure<? super E> procedure)
          Executes procedure for each element in the set.
 TObjectHashIterator<E> 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.
 java.lang.String toString()
           
protected  void writeEntries(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, 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

TLinkedHashSet

public TLinkedHashSet()
Creates a new THashSet instance with the default capacity and load factor.


TLinkedHashSet

public TLinkedHashSet(int initialCapacity)
Creates a new THashSet instance with a prime capacity equal to or greater than initialCapacity and with the default load factor.

Parameters:
initialCapacity - an int value

TLinkedHashSet

public TLinkedHashSet(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.

Parameters:
initialCapacity - an int value
loadFactor - a float value

TLinkedHashSet

public TLinkedHashSet(java.util.Collection<? extends E> es)
Creates a new THashSet instance containing the elements of collection.

Parameters:
es - a Collection value
Method Detail

setUp

public int setUp(int initialCapacity)
initializes the Object set of this hash table.

Overrides:
setUp in class gnu.trove.impl.hash.TObjectHash<E>
Parameters:
initialCapacity - an int value
Returns:
an int value

clear

public void clear()
Empties the set.

Specified by:
clear in interface java.util.Collection<E>
Specified by:
clear in interface java.util.Set<E>
Overrides:
clear in class THashSet<E>

toString

public java.lang.String toString()
Overrides:
toString in class THashSet<E>

add

public boolean add(E obj)
Inserts a value into the set.

Specified by:
add in interface java.util.Collection<E>
Specified by:
add in interface java.util.Set<E>
Overrides:
add in class THashSet<E>
Parameters:
obj - an Object value
Returns:
true if the set was modified by the add operation

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 class gnu.trove.impl.hash.TObjectHash<E>
Parameters:
index - an int value

rehash

protected void rehash(int newCapacity)
Expands the set to accommodate new values.

Overrides:
rehash in class THashSet<E>
Parameters:
newCapacity - an int value

writeEntries

protected void writeEntries(java.io.ObjectOutput out)
                     throws java.io.IOException
Overrides:
writeEntries in class THashSet<E>
Throws:
java.io.IOException

iterator

public TObjectHashIterator<E> iterator()
Creates an iterator over the values of the set. The iterator supports element deletion.

Specified by:
iterator in interface java.lang.Iterable<E>
Specified by:
iterator in interface java.util.Collection<E>
Specified by:
iterator in interface java.util.Set<E>
Overrides:
iterator in class THashSet<E>
Returns:
an Iterator value

forEach

public boolean forEach(TObjectProcedure<? super E> procedure)
Executes procedure for each element in the set.

Overrides:
forEach in class gnu.trove.impl.hash.TObjectHash<E>
Parameters:
procedure - a TObjectProcedure value
Returns:
false if the loop over the set terminated because the procedure returned false for some value.

GNU Trove