|
GNU Trove | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgnu.trove.THash
gnu.trove.TObjectHash<E>
gnu.trove.THashSet<E>
public class THashSet<E>
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
| Field Summary |
|---|
| Fields inherited from class gnu.trove.TObjectHash |
|---|
_hashingStrategy, _set, FREE, REMOVED |
| Fields inherited from class gnu.trove.THash |
|---|
_autoCompactionFactor, _autoCompactRemovesRemaining, _free, _loadFactor, _maxSize, _size, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR |
| Constructor Summary | |
|---|---|
THashSet()
Creates a new THashSet instance with the default
capacity and load factor. |
|
THashSet(java.util.Collection<? extends E> collection)
Creates a new THashSet instance containing the
elements of collection. |
|
THashSet(java.util.Collection<? extends E> collection,
TObjectHashingStrategy<E> strategy)
Creates a new THashSet instance containing the
elements of collection. |
|
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,
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<E> strategy)
Creates a new THashSet instance with a prime
capacity equal to or greater than initialCapacity and
with the specified load factor. |
|
THashSet(int initialCapacity,
TObjectHashingStrategy<E> strategy)
Creates a new THashSet instance with a prime
capacity equal to or greater than initialCapacity and
with the default load factor. |
|
THashSet(TObjectHashingStrategy<E> strategy)
Creates a new THashSet instance with the default
capacity and load factor. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(E obj)
Inserts a value into the set. |
|
boolean |
addAll(java.util.Collection<? extends E> collection)
Adds all of the elements in collection to the set. |
|
void |
clear()
Empties the set. |
|
boolean |
containsAll(java.util.Collection<?> collection)
Tests the set to determine if all of the elements in collection are present. |
|
boolean |
equals(java.lang.Object other)
|
|
int |
hashCode()
|
|
java.util.Iterator<E> |
iterator()
Creates an iterator over the values of the set. |
|
void |
readExternal(java.io.ObjectInput in)
|
|
protected void |
rehash(int newCapacity)
Expands the set to accommodate new values. |
|
boolean |
remove(java.lang.Object obj)
Removes obj from the set. |
|
boolean |
removeAll(java.util.Collection<?> collection)
Removes all of the elements in collection from the set. |
|
boolean |
retainAll(java.util.Collection<?> collection)
Removes any values in the set which are not contained in collection. |
|
java.lang.Object[] |
toArray()
Returns a new array containing the objects in the set. |
|
|
toArray(T[] a)
Returns a typed array of the objects in the set. |
|
java.lang.String |
toString()
|
|
void |
writeExternal(java.io.ObjectOutput out)
|
|
| Methods inherited from class gnu.trove.TObjectHash |
|---|
capacity, clone, computeHashCode, contains, equals, forEach, index, insertionIndex, removeAt, setUp, throwObjectContractViolation |
| Methods inherited from class gnu.trove.THash |
|---|
calculateGrownCapacity, compact, ensureCapacity, getAutoCompactionFactor, isEmpty, postInsertHook, reenableAutoCompaction, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSize |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
contains, isEmpty, size |
| Constructor Detail |
|---|
public THashSet()
THashSet instance with the default
capacity and load factor.
public THashSet(TObjectHashingStrategy<E> strategy)
THashSet instance with the default
capacity and load factor.
strategy - used to compute hash codes and to compare objects.public THashSet(int initialCapacity)
THashSet instance with a prime
capacity equal to or greater than initialCapacity and
with the default load factor.
initialCapacity - an int value
public THashSet(int initialCapacity,
TObjectHashingStrategy<E> strategy)
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.
public THashSet(int initialCapacity,
float loadFactor)
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
public THashSet(int initialCapacity,
float loadFactor,
TObjectHashingStrategy<E> strategy)
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.public THashSet(java.util.Collection<? extends E> collection)
THashSet instance containing the
elements of collection.
collection - a Collection value
public THashSet(java.util.Collection<? extends E> collection,
TObjectHashingStrategy<E> strategy)
THashSet instance containing the
elements of collection.
collection - a Collection valuestrategy - used to compute hash codes and to compare objects.| Method Detail |
|---|
public boolean add(E obj)
add in interface java.util.Collection<E>add in interface java.util.Set<E>obj - an Object value
public boolean equals(java.lang.Object other)
equals in interface java.util.Collection<E>equals in interface java.util.Set<E>equals in class java.lang.Objectpublic int hashCode()
hashCode in interface java.util.Collection<E>hashCode in interface java.util.Set<E>hashCode in class java.lang.Objectprotected void rehash(int newCapacity)
rehash in class THashnewCapacity - an int valuepublic java.lang.Object[] toArray()
toArray in interface java.util.Collection<E>toArray in interface java.util.Set<E>Object[] valuepublic <T> T[] toArray(T[] a)
toArray in interface java.util.Collection<E>toArray in interface java.util.Set<E>a - an Object[] value
Object[] valuepublic void clear()
clear in interface java.util.Collection<E>clear in interface java.util.Set<E>clear in class THashpublic boolean remove(java.lang.Object obj)
remove in interface java.util.Collection<E>remove in interface java.util.Set<E>obj - an Object value
public java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E>iterator in interface java.util.Collection<E>iterator in interface java.util.Set<E>Iterator valuepublic boolean containsAll(java.util.Collection<?> collection)
containsAll in interface java.util.Collection<E>containsAll in interface java.util.Set<E>collection - a Collection value
public boolean addAll(java.util.Collection<? extends E> collection)
addAll in interface java.util.Collection<E>addAll in interface java.util.Set<E>collection - a Collection value
public boolean removeAll(java.util.Collection<?> collection)
removeAll in interface java.util.Collection<E>removeAll in interface java.util.Set<E>collection - a Collection value
public boolean retainAll(java.util.Collection<?> collection)
retainAll in interface java.util.Collection<E>retainAll in interface java.util.Set<E>collection - a Collection value
public java.lang.String toString()
toString in class java.lang.Object
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.ExternalizablewriteExternal in class TObjectHash<E>java.io.IOException
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.ExternalizablereadExternal in class TObjectHash<E>java.io.IOException
java.lang.ClassNotFoundException
|
GNU Trove | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||