public class ObjectToFloatMap<K>
extends java.lang.Object
Constructor and Description |
---|
ObjectToFloatMap()
Constructs a map with default capacity.
|
ObjectToFloatMap(int capacity)
Constructs a map with given capacity.
|
Modifier and Type | Method and Description |
---|---|
protected int |
calcBaseHashIndex(K key)
Calculating the baseHash index using the internal
hashFactor . |
void |
clear()
Empties the map.
|
boolean |
containsKey(K key)
Checks if a given key exists in the map.
|
boolean |
containsValue(float 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(K key)
Find the actual index of a given key.
|
float |
get(K key)
Returns the float mapped with the given key.
|
protected void |
grow()
Grows the map.
|
int |
hashCode() |
boolean |
isEmpty() |
FloatIterator |
iterator()
Returns a new iterator for the mapped floats.
|
java.util.Iterator<K> |
keyIterator()
Returns an iterator on the map keys.
|
float |
put(K key,
float e)
Inserts the <key,value> pair into the map.
|
float |
remove(K key)
Removes a <key,value> pair from the map and returns the mapped value,
or
Float.NaN if the none existed. |
int |
size() |
float[] |
toArray()
Translates the mapped pairs' values into an array of Objects
|
float[] |
toArray(float[] a)
Translates the mapped pairs' values into an array of T
|
java.lang.String |
toString() |
public ObjectToFloatMap()
public ObjectToFloatMap(int capacity)
capacity
- minimum capacity for the map.protected int calcBaseHashIndex(K key)
hashFactor
.key
- public void clear()
public boolean containsKey(K key)
key
- that is checked against the map data.public boolean containsValue(float o)
o
- object that is checked against the map data.protected int find(K key)
key
- public float get(K key)
key
- object who's mapped float we're interested in.protected void grow()
public boolean isEmpty()
public FloatIterator iterator()
public java.util.Iterator<K> keyIterator()
public float put(K key, float e)
Float.NaN
if the key didn't exist.public float remove(K key)
Float.NaN
if the none existed.key
- used to find the value to removeFloat.NaN
if none existed.public int size()
public float[] toArray()
public float[] toArray(float[] a)
a
- the array into which the elements of the list are to be
stored, if it is big enough; otherwise, use as much space as it can.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
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.