public class IntToObjectMap<T> extends Object implements Iterable<T>
Constructor and Description |
---|
IntToObjectMap()
Constructs a map with default capacity.
|
IntToObjectMap(int capacity)
Constructs a map with given capacity.
|
Modifier and Type | Method and Description |
---|---|
protected int |
calcBaseHashIndex(int key)
Calculating the baseHash index using the internal
hashFactor . |
void |
clear()
Empties the map.
|
boolean |
containsKey(int key)
Checks if a given key exists in the map.
|
boolean |
containsValue(Object o)
Checks if the given object exists in the map.
This method iterates over the collection, trying to find an equal object. |
boolean |
equals(Object o) |
protected int |
find(int key)
Find the actual index of a given key.
|
T |
get(int key)
Returns the object mapped with the given key.
|
protected void |
grow()
Grows the map.
|
int |
hashCode() |
boolean |
isEmpty() |
Iterator<T> |
iterator()
Returns a new iterator for the mapped objects.
|
IntIterator |
keyIterator()
Returns an iterator on the map keys.
|
T |
put(int key,
T e)
Inserts the <key,value> pair into the map.
|
T |
remove(int key)
Removes a <key,value> pair from the map and returns the mapped value,
or null if the none existed.
|
int |
size() |
Object[] |
toArray()
Translates the mapped pairs' values into an array of Objects
|
T[] |
toArray(T[] a)
Translates the mapped pairs' values into an array of T
|
String |
toString() |
public IntToObjectMap()
public IntToObjectMap(int capacity)
capacity
- minimum capacity for the map.protected int calcBaseHashIndex(int key)
hashFactor
.public void clear()
public boolean containsKey(int key)
key
- that is checked against the map data.public boolean containsValue(Object o)
o
- object that is checked against the map data.protected int find(int key)
public T get(int key)
key
- int who's mapped object we're interested in.protected void grow()
public boolean isEmpty()
public IntIterator keyIterator()
public T put(int key, T e)
public T remove(int key)
key
- used to find the value to removepublic int size()
public Object[] toArray()
public T[] toArray(T[] a)
a
- the array into which the elements of the list are to be
stored, if it is big enough; otherwise, use whatever space we
have, setting the one after the true data as null.Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.