gnu.trove
Class THashSet<E>
- Externalizable, Iterable, Set
public class THashSet<E>
extends TObjectHash
implements Set, Iterable, Externalizable
An implementation of the Set interface that uses an
open-addressed hash table to store its contents.
Created: Sat Nov 3 10:38:17 2001
$Id: THashSet.java,v 1.20 2008/05/07 19:26:30 robeden Exp $THashSet() - Creates a new
THashSet instance with the default
capacity and load factor.
|
THashSet(E> collection) - Creates a new
THashSet instance containing the
elements of collection.
|
THashSet(E> collection, TObjectHashingStrategy strategy) - Creates a new
THashSet instance containing the
elements of collection.
|
THashSet(TObjectHashingStrategy strategy) - Creates a new
THashSet instance with the default
capacity and load factor.
|
THashSet(int initialCapacity) - Creates a new
THashSet instance with a prime
capacity equal to or greater than initialCapacity and
with the default load factor.
|
THashSet(int initialCapacity, TObjectHashingStrategy strategy) - Creates a new
THashSet instance with a prime
capacity equal to or greater than initialCapacity and
with the default load factor.
|
THashSet(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.
|
THashSet(int initialCapacity, float loadFactor, TObjectHashingStrategy strategy) - Creates a new
THashSet instance with a prime
capacity equal to or greater than initialCapacity and
with the specified load factor.
|
| T[] toArray(T[] a) - Returns a typed array of the objects in the set.
|
boolean | add(E obj) - Inserts a value into the set.
|
boolean | addAll(E> collection) - Adds all of the elements in collection to the set.
|
void | clear() - Empties the set.
|
boolean | containsAll(Collection> collection) - Tests the set to determine if all of the elements in
collection are present.
|
boolean | equals(Object other)
|
int | hashCode()
|
Iterator | iterator() - Creates an iterator over the values of the set.
|
void | readExternal(ObjectInput in)
|
protected void | rehash(int newCapacity) - Expands the set to accommodate new values.
|
boolean | remove(Object obj) - Removes obj from the set.
|
boolean | removeAll(Collection> collection) - Removes all of the elements in collection from the set.
|
boolean | retainAll(Collection> collection) - Removes any values in the set which are not contained in
collection.
|
Object[] | toArray() - Returns a new array containing the objects in the set.
|
String | toString()
|
void | writeExternal(ObjectOutput out)
|
THashSet
public THashSet()
Creates a new THashSet
instance with the default
capacity and load factor.
THashSet
public THashSet(E> collection)
Creates a new THashSet
instance containing the
elements of collection.
collection
- a Collection
value
THashSet
public THashSet(E> collection,
TObjectHashingStrategy strategy)
Creates a new THashSet
instance containing the
elements of collection.
collection
- a Collection
valuestrategy
- used to compute hash codes and to compare objects.
THashSet
public THashSet(TObjectHashingStrategy strategy)
Creates a new THashSet
instance with the default
capacity and load factor.
strategy
- used to compute hash codes and to compare objects.
THashSet
public THashSet(int initialCapacity)
Creates a new THashSet
instance with a prime
capacity equal to or greater than initialCapacity and
with the default load factor.
initialCapacity
- an int
value
THashSet
public THashSet(int initialCapacity,
TObjectHashingStrategy strategy)
Creates a new THashSet
instance with a prime
capacity equal to or greater than initialCapacity and
with the default load factor.
initialCapacity
- an int
valuestrategy
- used to compute hash codes and to compare objects.
THashSet
public THashSet(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.
initialCapacity
- an int
valueloadFactor
- a float
value
THashSet
public THashSet(int initialCapacity,
float loadFactor,
TObjectHashingStrategy strategy)
Creates a new THashSet
instance with a prime
capacity equal to or greater than initialCapacity and
with the specified load factor.
initialCapacity
- an int
valueloadFactor
- a float
valuestrategy
- used to compute hash codes and to compare objects.
T[] toArray
public T[] toArray(T[] a)
Returns a typed array of the objects in the set.
add
public boolean add(E obj)
Inserts a value into the set.
- true if the set was modified by the add operation
addAll
public boolean addAll(E> collection)
Adds all of the elements in collection to the set.
collection
- a Collection
value
- true if the set was modified by the add all operation.
clear
public void clear()
Empties the set.
containsAll
public boolean containsAll(Collection> collection)
Tests the set to determine if all of the elements in
collection are present.
collection
- a Collection
value
- true if all elements were present in the set.
equals
public boolean equals(Object other)
hashCode
public int hashCode()
iterator
public Iterator iterator()
Creates an iterator over the values of the set. The iterator
supports element deletion.
readExternal
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
rehash
protected void rehash(int newCapacity)
Expands the set to accommodate new values.
newCapacity
- an int
value
remove
public boolean remove(Object obj)
Removes obj from the set.
- true if the set was modified by the remove operation.
removeAll
public boolean removeAll(Collection> collection)
Removes all of the elements in collection from the set.
collection
- a Collection
value
- true if the set was modified by the remove all operation.
retainAll
public boolean retainAll(Collection> collection)
Removes any values in the set which are not contained in
collection.
collection
- a Collection
value
- true if the set was modified by the retain all operation
toArray
public Object[] toArray()
Returns a new array containing the objects in the set.
toString
public String toString()
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException
GNU Trove is copyright B) 2001-2008 Eric D. Friedman. All Rights Reserved.