|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.tum.cs.commons.collections.ArrayBackedMap<K,V>
public class ArrayBackedMap<K,V>
A map implementation based on unsorted arrays. This is by far more memory
efficient than the usual map implementations and has reasonable performance
for small maps. Note that this map violates the map interface by just
returning copies for the set accessor methods (entrySet(),
values(), keySet()), i.e. they are not backed by the map.
Implementation hints:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
ArrayBackedMap()
Constructs a new map with an initial capacity of 4. |
|
ArrayBackedMap(int initialCapacity)
Constructor. |
|
| Method Summary | |
|---|---|
protected boolean |
areEqual(K key1,
K key2)
Template method for comparing two keys for equality. |
void |
clear()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set<Map.Entry<K,V>> |
entrySet()
|
V |
get(Object key)
|
protected K |
internKey(Object key)
Template method for calculating an internal key representation. |
boolean |
isEmpty()
|
Set<K> |
keySet()
|
V |
put(K key,
V value)
|
void |
putAll(Map<? extends K,? extends V> m)
|
V |
remove(Object key)
|
int |
size()
|
Collection<V> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public ArrayBackedMap()
public ArrayBackedMap(int initialCapacity)
| Method Detail |
|---|
public void clear()
clear in interface Map<K,V>public boolean containsKey(Object key)
containsKey in interface Map<K,V>
protected K internKey(Object key)
throws ClassCastException
ClassCastException - if the provided key is not of a suitable class.
protected boolean areEqual(K key1,
K key2)
public V get(Object key)
get in interface Map<K,V>
public V put(K key,
V value)
put in interface Map<K,V>public V remove(Object key)
remove in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>public boolean isEmpty()
isEmpty in interface Map<K,V>public Set<K> keySet()
keySet in interface Map<K,V>public void putAll(Map<? extends K,? extends V> m)
putAll in interface Map<K,V>public int size()
size in interface Map<K,V>public Collection<V> values()
values in interface Map<K,V>
|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||