|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectUtils.ArrayMap<K,V>
K
- The key typeV
- The value typepublic class ArrayMap<K,V>
A crude map of a fixed size that is backed by an array. Created to be memory effecient and allow quick updating of values (when their index is known) but still allow more user friendly access by key. Error checks are deliberately not done on put() and getEntry() for effeciency reasons. Calling code should ensure the map is big enough and that the index is valid else an ArrayIndexOutOfBoundsException will be thrown
Constructor Summary | |
---|---|
ArrayMap(java.lang.Class<K> k,
java.lang.Class<V> v,
int size)
Default Constructor. |
Method Summary | |
---|---|
boolean |
containsKey(K k)
Tests whether the map contains a key |
boolean |
equals(java.lang.Object o)
|
V |
get(K k)
Gets the value for a given key |
java.util.AbstractMap.SimpleEntry<K,V> |
getEntry(int i)
Gets the key/value entry at a given location Error checks are deliberately not done for effeciency reasons. |
java.util.ArrayList<K> |
keyList()
Gets a list of keys in the map |
void |
put(int i,
K k,
V v)
Puts a new key/value pair into the map at a given location Error checks are deliberately not done for effeciency reasons. |
void |
put(K k,
V v)
Puts a new key/value pair into the map Error checks are deliberately not done for effeciency reasons. |
int |
size()
Returns the size of the map. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayMap(java.lang.Class<K> k, java.lang.Class<V> v, int size)
k
- The class of the keysv
- The class of the valuessize
- The size of the mapMethod Detail |
---|
public void put(K k, V v)
k
- The keyv
- The valuepublic void put(int i, K k, V v)
i
- The location to add the key / value pairk
- The keyv
- The valuepublic java.util.ArrayList<K> keyList()
public java.util.AbstractMap.SimpleEntry<K,V> getEntry(int i)
i
- The location to return the entry for
public int size()
public boolean containsKey(K k)
k
- The key to test for
public V get(K k)
k
- The key
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |