|Method from org.apache.mahout.math.set.OpenHashSet Detail:|
public boolean add(Object key)
public boolean addAll(Collection<? extends T> c)
public void clear()
Removes all values associations from the receiver. Implicitly calls trimToSize().
public Object clone()
Returns a deep copy of the receiver.
public boolean contains(Object key)
Returns true if the receiver contains the specified key.
public boolean containsAll(Collection<?> c)
public void ensureCapacity(int minCapacity)
Ensures that the receiver can hold at least the specified number of associations without needing to allocate new
internal memory. If necessary, allocates new internal memory and increases the capacity of the receiver.
method never need be called; it is for performance tuning only. Calling this method before add()ing a
large number of associations boosts performance, because the receiver will grow only once instead of potentially
many times and hash collisions get less probable.
public boolean equals(Object obj)
OpenHashSet instances are only equal to other OpenHashSet instances, not to
any other collection. Hypothetically, we should check for and permit
equals on other Sets.
public boolean forEachKey(ObjectProcedure<T> procedure)
Applies a procedure to each key of the receiver, if any. Note: Iterates over the keys in no particular order.
Subclasses can define a particular order, for example, "sorted by key". All methods which can be expressed
in terms of this method (most methods can) must guarantee to use the same order defined by this
method, even if it is no particular order. This is necessary so that, for example, methods keys and
values will yield association pairs, not two uncorrelated lists.
void getInternalFactors(int capacity,
protected int indexOfInsertion(T key)
protected int indexOfKey(T key)
public boolean isEmpty()
public Iterator<T> iterator()
Implement the standard Java Collections iterator. Note that 'remove' is silently
ineffectual here. This method is provided for convenience, only.
public List<T> keys()
public void keys(List<T> list)
Fills all keys contained in the receiver into the specified list. Fills the list, starting at index 0. After this
call returns the specified list has a new size that equals this.size().
This method can be used
to iterate over the keys of the receiver.
protected void rehash(int newCapacity)
Rehashes the contents of the receiver into a new table with a smaller or larger capacity. This method is called
automatically when the number of keys in the receiver exceeds the high water mark or falls below the low water
public boolean remove(Object key)
Removes the given key with its associated element from the receiver, if present.
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
protected void setUp(int initialCapacity,
Initializes the receiver.
public Object toArray()
public T2 toArray(T2 a)
public void trimToSize()
Trims the capacity of the receiver to be the receiver's current size. Releases any superfluous internal memory. An
application can use this operation to minimize the storage of the receiver.