org.axiondb.engine.rowcollection

Class IntHashMap

public class IntHashMap extends Object

Int key and Object value Map, this does not implement java.util.Map interface and has limited Map like API. Does not implement EntrySet and and KeySet, tather it just retunds their iterator.

Version: $Revision: 1.2 $ $Date: 2005/12/22 09:02:30 $

Author: Ahimanikya Satapathy

Nested Class Summary
static classIntHashMap.Entry
This class represents a IntHashMapentry.
classIntHashMap.EntryIterator
classIntHashMap.ValueIterator
protected classIntHashMap.Values
Constructor Summary
IntHashMap()
Creates an IntHashMap of small initial capacity.
IntHashMap(int capacity)
Creates an IntHashMap of specified initial capacity.
IntHashMap(IntHashMap map)
Creates a IntHashMap containing the specified entries, in the order they are returned by the map's iterator.
Method Summary
protected voidaddEntry(int hash, int key, Object value)
Adds a new entry for the specified key and value.
voidclear()
Removes all mappings from this IntHashMap.
booleancontainsKey(int key)
Indicates if this IntHashMapcontains a mapping for the specified key.
booleancontainsValue(Object value)
Indicates if this IntHashMapmaps one or more keys to the specified value.
IntHashMap.EntryIteratorentryIterator()
booleanequals(Object obj)
Compares the specified object with this IntHashMapfor equality.
Objectget(int key)
Returns the value to which this IntHashMapmaps the specified key.
IntHashMap.EntrygetEntry(int key)
Returns the entry with the specified key.
inthashCode()
Returns the hash code value for this IntHashMap.
IntHashMap.EntryheadEntry()
Returns the head entry of this map.
booleanisEmpty()
Indicates if this IntHashMapcontains no key-value mappings.
IntListIteratorkeyIterator()
IntCollectionkeys()
protected IntHashMap.EntrynewEntry()
Returns a new entry for this map; sub-classes may override this method to use custom entries.
Objectput(int key, Object value)
Associates the specified value with the specified key in this IntHashMap.
voidputAll(IntHashMap that)
Copies all of the mappings from the specified map to this IntHashMap.
Objectremove(int key)
Removes the mapping for this key from this IntHashMapif present.
voidremoveEntry(IntHashMap.Entry entry)
Removes the specified entry from the map.
intsize()
Returns the number of key-value mappings in this IntHashMap.
IntHashMap.EntrytailEntry()
Returns the tail entry of this map.
StringtoString()
Returns the textual representation of this IntHashMap.
IntHashMap.ValueIteratorvalueIterator()
Returns a list iterator over the values in this list in proper sequence, (this map maintains the insertion order).
IntHashMap.Valuesvalues()
Returns a RowCollectionview of the values contained in this IntHashMap.

Constructor Detail

IntHashMap

public IntHashMap()
Creates an IntHashMap of small initial capacity.

IntHashMap

public IntHashMap(int capacity)
Creates an IntHashMap of specified initial capacity. Unless the map size exceeds the specified capacity no memory allocation is ever performed.

Parameters: capacity the initial capacity.

IntHashMap

public IntHashMap(IntHashMap map)
Creates a IntHashMap containing the specified entries, in the order they are returned by the map's iterator.

Parameters: map the map whose entries are to be placed into this map.

Method Detail

addEntry

protected void addEntry(int hash, int key, Object value)
Adds a new entry for the specified key and value.

Parameters: hash the hash of the key, generated with IntHashMap. key the entry's key. value the entry's value.

clear

public void clear()
Removes all mappings from this IntHashMap.

containsKey

public final boolean containsKey(int key)
Indicates if this IntHashMapcontains a mapping for the specified key.

Parameters: key the key whose presence in this map is to be tested.

Returns: true if this map contains a mapping for the specified key; false otherwise.

containsValue

public final boolean containsValue(Object value)
Indicates if this IntHashMapmaps one or more keys to the specified value.

Parameters: value the value whose presence in this map is to be tested.

Returns: true if this map maps one or more keys to the specified value.

entryIterator

public IntHashMap.EntryIterator entryIterator()

equals

public boolean equals(Object obj)
Compares the specified object with this IntHashMapfor equality. Returns true if the given object is also a map and the two maps represent the same mappings (regardless of collection iteration order).

Parameters: obj the object to be compared for equality with this map.

Returns: true if the specified object is equal to this map; false otherwise.

get

public final Object get(int key)
Returns the value to which this IntHashMapmaps the specified key.

Parameters: key the key whose associated value is to be returned.

Returns: the value to which this map maps the specified key, or null if there is no mapping for the key.

getEntry

public final IntHashMap.Entry getEntry(int key)
Returns the entry with the specified key.

Parameters: key the key whose associated entry is to be returned.

Returns: the entry for the specified key or null if none.

hashCode

public int hashCode()
Returns the hash code value for this IntHashMap.

Returns: the hash code value for this map.

headEntry

public final IntHashMap.Entry headEntry()
Returns the head entry of this map.

Returns: the entry such as headEntry().getNextEntry() holds the first map entry.

isEmpty

public final boolean isEmpty()
Indicates if this IntHashMapcontains no key-value mappings.

Returns: true if this map contains no key-value mappings; false otherwise.

keyIterator

public IntListIterator keyIterator()

keys

public IntCollection keys()

newEntry

protected IntHashMap.Entry newEntry()
Returns a new entry for this map; sub-classes may override this method to use custom entries.

Returns: a new entry potentially preallocated.

put

public final Object put(int key, Object value)
Associates the specified value with the specified key in this IntHashMap. If the IntHashMappreviously contained a mapping for this key, the old value is replaced.

Parameters: key the key with which the specified value is to be associated. value the value to be associated with the specified key.

Returns: the previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key.

putAll

public final void putAll(IntHashMap that)
Copies all of the mappings from the specified map to this IntHashMap.

Parameters: map the mappings to be stored in this map.

remove

public final Object remove(int key)
Removes the mapping for this key from this IntHashMapif present.

Parameters: key the key whose mapping is to be removed from the map.

Returns: previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key.

removeEntry

public void removeEntry(IntHashMap.Entry entry)
Removes the specified entry from the map.

Parameters: entry the entry to be removed.

size

public final int size()
Returns the number of key-value mappings in this IntHashMap.

Returns: this map's size.

tailEntry

public final IntHashMap.Entry tailEntry()
Returns the tail entry of this map.

Returns: the entry such as tailEntry().getPreviousEntry() holds the last map entry.

toString

public String toString()
Returns the textual representation of this IntHashMap.

Returns: the textual representation of the entry set.

valueIterator

public final IntHashMap.ValueIterator valueIterator()
Returns a list iterator over the values in this list in proper sequence, (this map maintains the insertion order).

Returns: a list iterator of the values in this list (in proper sequence).

values

public final IntHashMap.Values values()
Returns a RowCollectionview of the values contained in this IntHashMap. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. The collection supports element removal, which removes the corresponding mapping from this map, via the RowIterator.remove,RowCollection.remove and clear operations.

Returns: a row collection view of the values contained in this map.