public class ArrayBackedMap<K,V> extends java.lang.Object implements java.util.Map<K,V>
entrySet()
,
values()
, keySet()
), i.e. they are not backed by the map.
Implementation hints:
Constructor and Description |
---|
ArrayBackedMap()
Constructs a new map with an initial capacity of 4.
|
ArrayBackedMap(ArrayBackedMap<K,V> other)
Copy constructor.
|
ArrayBackedMap(int initialCapacity)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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() |
boolean |
equals(java.lang.Object obj) |
V |
get(java.lang.Object key) |
int |
hashCode() |
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.lang.String |
toString() |
java.util.Collection<V> |
values() |
public ArrayBackedMap()
public ArrayBackedMap(int initialCapacity)
public ArrayBackedMap(ArrayBackedMap<K,V> other)
public boolean containsKey(java.lang.Object key)
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 boolean containsValue(java.lang.Object value)
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()