Class TLinkedHashSet<E>

    • 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(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  TObjectHash<E>
        Parameters:
        initialCapacity - an int value
        Returns:
        an int value
      • clear

        public void clear()
        Empties the set.
      • toString

        public String toString()
      • 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  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: THash
        Delete the record at index. Reduces the size of the collection by one.
        Overrides:
        removeAt in class  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
      • forEach

        public boolean forEach(TObjectProcedure<? super E> procedure)
        Executes procedure for each element in the set.
        Overrides:
        forEach in class  TObjectHash<E>
        Parameters:
        procedure - a TObjectProcedure value
        Returns:
        false if the loop over the set terminated because the procedure returned false for some value.