|
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 |
|---|
java.util.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(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
V |
get(java.lang.Object key)
|
protected K |
internKey(java.lang.Object key)
Template method for calculating an internal key representation. |
boolean |
isEmpty()
|
java.util.Set<K> |
keySet()
|
V |
put(K key,
V value)
|
void |
putAll(java.util.Map<? extends K,? extends V> m)
|
V |
remove(java.lang.Object key)
|
int |
size()
|
java.util.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 java.util.Map<K,V>public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<K,V>
protected K internKey(java.lang.Object key)
throws java.lang.ClassCastException
java.lang.ClassCastException - if the provided key is not of a suitable class.
protected boolean areEqual(K key1,
K key2)
public V get(java.lang.Object key)
get in interface java.util.Map<K,V>
public V put(K key,
V value)
put in interface java.util.Map<K,V>public V remove(java.lang.Object key)
remove in interface java.util.Map<K,V>public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<K,V>public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet in interface java.util.Map<K,V>public boolean isEmpty()
isEmpty in interface java.util.Map<K,V>public java.util.Set<K> keySet()
keySet in interface java.util.Map<K,V>public void putAll(java.util.Map<? extends K,? extends V> m)
putAll in interface java.util.Map<K,V>public int size()
size in interface java.util.Map<K,V>public java.util.Collection<V> values()
values in interface java.util.Map<K,V>
|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||