gnu.trove.impl.hash
Class TObjectHash<T>
- java.lang.Object
-
- gnu.trove.impl.hash.THash
-
- gnu.trove.impl.hash.TObjectHash<T>
-
- All Implemented Interfaces:
- java.io.Externalizable, java.io.Serializable
- Direct Known Subclasses:
- TCustomObjectHash, THashMap, THashSet, TObjectByteHashMap, TObjectCharHashMap, TObjectDoubleHashMap, TObjectFloatHashMap, TObjectIntHashMap, TObjectLongHashMap, TObjectShortHashMap
public abstract class TObjectHash<T> extends THash
An open addressed hashing implementation for Object types. Created: Sun Nov 4 08:56:06 2001- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description java.lang.Object[]_setthe set of Objectsstatic java.lang.ObjectFREEstatic java.lang.ObjectREMOVED
-
Constructor Summary
Constructors Constructor and Description TObjectHash()Creates a newTObjectHashinstance with the default capacity and load factor.TObjectHash(int initialCapacity)Creates a newTObjectHashinstance whose capacity is the next highest prime above initialCapacity + 1 unless that value is already prime.TObjectHash(int initialCapacity, float loadFactor)Creates a newTObjectHashinstance with a prime value at or near the specified capacity and load factor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcapacity()booleancontains(java.lang.Object obj)Searches the set for objbooleanforEach(TObjectProcedure<? super T> procedure)Executes procedure for each element in the set.voidreadExternal(java.io.ObjectInput in)intsetUp(int initialCapacity)initializes the Object set of this hash table.voidwriteExternal(java.io.ObjectOutput out)-
Methods inherited from class gnu.trove.impl.hash.THash
clear, compact, ensureCapacity, getAutoCompactionFactor, isEmpty, reenableAutoCompaction, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSize
-
-
-
-
Field Detail
-
_set
public transient java.lang.Object[] _set
the set of Objects
-
REMOVED
public static final java.lang.Object REMOVED
-
FREE
public static final java.lang.Object FREE
-
-
Constructor Detail
-
TObjectHash
public TObjectHash()
Creates a newTObjectHashinstance with the default capacity and load factor.
-
TObjectHash
public TObjectHash(int initialCapacity)
Creates a newTObjectHashinstance whose capacity is the next highest prime above initialCapacity + 1 unless that value is already prime.- Parameters:
initialCapacity- anintvalue
-
TObjectHash
public TObjectHash(int initialCapacity, float loadFactor)Creates a newTObjectHashinstance with a prime value at or near the specified capacity and load factor.- Parameters:
initialCapacity- used to find a prime capacity for the table.loadFactor- used to calculate the threshold over which rehashing takes place.
-
-
Method Detail
-
capacity
public int capacity()
-
setUp
public int setUp(int initialCapacity)
initializes the Object set of this hash table.- Parameters:
initialCapacity- anintvalue- Returns:
- an
intvalue
-
forEach
public boolean forEach(TObjectProcedure<? super T> procedure)
Executes procedure for each element in the set.- Parameters:
procedure- aTObjectProcedurevalue- Returns:
- false if the loop over the set terminated because the procedure returned false for some value.
-
contains
public boolean contains(java.lang.Object obj)
Searches the set for obj- Parameters:
obj- anObjectvalue- Returns:
- a
booleanvalue
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Overrides:
writeExternalin classTHash- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Overrides:
readExternalin classTHash- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG