public class FloatToObjectMap<T>
extends java.lang.Object
implements java.lang.Iterable<T>
Constructor and Description |
---|
FloatToObjectMap()
Constructs a map with default capacity.
|
FloatToObjectMap(int capacity)
Constructs a map with given capacity.
|
Modifier and Type | Method and Description |
---|---|
protected int |
calcBaseHashIndex(float key)
Calculating the baseHash index using the internal
hashFactor . |
void |
clear()
Empties the map.
|
boolean |
containsKey(float key)
Checks if a given key exists in the map.
|
boolean |
containsValue(java.lang.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(java.lang.Object o) |
protected int |
find(float key)
Find the actual index of a given key.
|
T |
get(float key)
Returns the object mapped with the given key.
|
protected void |
grow()
Grows the map.
|
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator()
Returns a new iterator for the mapped objects.
|
FloatIterator |
keyIterator()
Returns an iterator on the map keys.
|
T |
put(float key,
T e)
Inserts the <key,value> pair into the map.
|
T |
remove(float key)
Removes a <key,value> pair from the map and returns the mapped value,
or null if the none existed.
|
int |
size() |
java.lang.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
|
java.lang.String |
toString() |
public FloatToObjectMap()
public FloatToObjectMap(int capacity)
capacity
- minimum capacity for the map.protected int calcBaseHashIndex(float key)
hashFactor
.key
- public void clear()
public boolean containsKey(float key)
key
- that is checked against the map data.public boolean containsValue(java.lang.Object o)
o
- object that is checked against the map data.protected int find(float key)
key
- public T get(float key)
key
- int who's mapped object we're interested in.protected void grow()
public boolean isEmpty()
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
public FloatIterator keyIterator()
public T put(float key, T e)
public T remove(float key)
key
- used to find the value to removepublic int size()
public java.lang.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.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object