public class THashSet extends TObjectHash implements java.util.Set, java.io.Serializable
| Modifier and Type | Class and Description |
|---|---|
private class |
THashSet.HashProcedure |
_hashingStrategy, _set, REMOVED_free, _loadFactor, _maxSize, _size, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR| Constructor and Description |
|---|
THashSet()
Creates a new
THashSet instance with the default
capacity and load factor. |
THashSet(java.util.Collection collection)
Creates a new
THashSet instance containing the
elements of collection. |
THashSet(java.util.Collection collection,
TObjectHashingStrategy 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 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 strategy)
Creates a new
THashSet instance with a prime
capacity equal to or greater than initialCapacity and
with the default load factor. |
THashSet(TObjectHashingStrategy strategy)
Creates a new
THashSet instance with the default
capacity and load factor. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(java.lang.Object obj)
Inserts a value into the set.
|
boolean |
addAll(java.util.Collection 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 |
iterator()
Creates an iterator over the values of the set.
|
private void |
readObject(java.io.ObjectInputStream stream) |
protected void |
rehash(int newCapacity)
Expands the set to accomodate 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.
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
Returns a typed array of the objects in the set.
|
private void |
writeObject(java.io.ObjectOutputStream stream) |
capacity, clone, computeHashCode, contains, equals, forEach, index, insertionIndex, removeAt, setUp, throwObjectContractViolationcompact, ensureCapacity, isEmpty, postInsertHook, size, trimToSizepublic THashSet()
THashSet instance with the default
capacity and load factor.public THashSet(TObjectHashingStrategy 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 valuepublic THashSet(int initialCapacity,
TObjectHashingStrategy 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 valuepublic THashSet(int initialCapacity,
float loadFactor,
TObjectHashingStrategy 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 collection)
THashSet instance containing the
elements of collection.collection - a Collection valuepublic THashSet(java.util.Collection collection,
TObjectHashingStrategy strategy)
THashSet instance containing the
elements of collection.collection - a Collection valuestrategy - used to compute hash codes and to compare objects.public boolean add(java.lang.Object obj)
add in interface java.util.Collectionadd in interface java.util.Setobj - an Object valuepublic boolean equals(java.lang.Object other)
equals in interface java.util.Collectionequals in interface java.util.Setequals in class java.lang.Objectpublic int hashCode()
hashCode in interface java.util.CollectionhashCode in interface java.util.SethashCode in class java.lang.Objectprotected void rehash(int newCapacity)
public java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.SetObject[] valuepublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.CollectiontoArray in interface java.util.Seta - an Object[] valueObject[] valuepublic void clear()
public boolean remove(java.lang.Object obj)
remove in interface java.util.Collectionremove in interface java.util.Setobj - an Object valuepublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.SetIterator valuepublic boolean containsAll(java.util.Collection collection)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.Setcollection - a Collection valuepublic boolean addAll(java.util.Collection collection)
addAll in interface java.util.CollectionaddAll in interface java.util.Setcollection - a Collection valuepublic boolean removeAll(java.util.Collection collection)
removeAll in interface java.util.CollectionremoveAll in interface java.util.Setcollection - a Collection valuepublic boolean retainAll(java.util.Collection collection)
retainAll in interface java.util.CollectionretainAll in interface java.util.Setcollection - a Collection valueprivate void writeObject(java.io.ObjectOutputStream stream)
throws java.io.IOException
java.io.IOExceptionprivate void readObject(java.io.ObjectInputStream stream)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundException