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>

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:
  • 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

    Constructors
    Constructor
    Description
    Creates a new THashSet instance with the default capacity and load factor.
    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.
    TLinkedHashSet(Collection<? extends E> es)
    Creates a new THashSet instance containing the elements of collection.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(E obj)
    Inserts a value into the set.
    void
    Empties the set.
    boolean
    forEach(gnu.trove.procedure.TObjectProcedure<? super E> procedure)
    Executes procedure for each element in the set.
    gnu.trove.iterator.hash.TObjectHashIterator<E>
    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)
     
    int
    setUp(int initialCapacity)
    initializes the Object set of this hash table.
     
    protected void
     

    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

    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.lang.Iterable

    forEach

    Methods inherited from interface java.util.Set

    contains, isEmpty, size, spliterator
  • Constructor Details

    • 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(Collection<? extends E> es)
      Creates a new THashSet instance containing the elements of collection.
      Parameters:
      es - a Collection value
  • Method Details

    • 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 Collection<E>
      Specified by:
      clear in interface Set<E>
      Overrides:
      clear in class gnu.trove.set.hash.THashSet<E>
    • toString

      public String toString()
      Overrides:
      toString in class gnu.trove.set.hash.THashSet<E>
    • add

      public boolean add(E obj)
      Inserts a value into the set.
      Specified by:
      add in interface Collection<E>
      Specified by:
      add in interface Set<E>
      Overrides:
      add in class gnu.trove.set.hash.THashSet<E>
      Parameters:
      obj - an Object value
      Returns:
      true if the set was modified by the add operation
    • removeAt

      protected void removeAt(int index)
      Overrides:
      removeAt in class gnu.trove.impl.hash.TObjectHash<E>
    • rehash

      protected void rehash(int newCapacity)
      Expands the set to accommodate new values.
      Overrides:
      rehash in class gnu.trove.set.hash.THashSet<E>
      Parameters:
      newCapacity - an int value
    • writeEntries

      protected void writeEntries(ObjectOutput out) throws IOException
      Overrides:
      writeEntries in class gnu.trove.set.hash.THashSet<E>
      Throws:
      IOException
    • iterator

      public gnu.trove.iterator.hash.TObjectHashIterator<E> iterator()
      Creates an iterator over the values of the set. The iterator supports element deletion.
      Specified by:
      iterator in interface Collection<E>
      Specified by:
      iterator in interface Iterable<E>
      Specified by:
      iterator in interface Set<E>
      Overrides:
      iterator in class gnu.trove.set.hash.THashSet<E>
      Returns:
      an Iterator value
    • forEach

      public boolean forEach(gnu.trove.procedure.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.