|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
net.sf.molae.pipe.genimpl.KeySetBasedMap<K,V>
net.sf.molae.pipe.hash.ListBackedMap<K,V>
public final class ListBackedMap<K,V>
This class implements the map interface with a list implementation. Prerequisite for this implementation is that
K the set of keys, then∀ k1, k2 ∈ K k1 ≠ k2 &there4 h(k1) ≠ h(k2)
For a good implementation the key set should not have big gaps and the maximum key value should not be too big. Null values are allowed. Null keys are not allowed.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
ListBackedMap(List<K> universe)
Constructs a new ListBackedMap. |
|
ListBackedMap(List<K> universe,
List<V> values)
Constructs a new ListBackedMap. |
|
ListBackedMap(Set<K> universe)
Constructs a new ListBackedMap. |
|
| Method Summary | ||
|---|---|---|
V |
get(Object key)
Returns the value to which this map maps the specified key. |
|
Set<K> |
keySet()
Returns a set view of the keys contained in this map. |
|
static
|
listAsMap(List<V> base)
Returns a map that maps integers to the list entry at the corresponding position in the base list. |
|
V |
put(K key,
V value)
|
|
V |
remove(Object key)
Removes the mapping for this key from this map if present (optional operation). |
|
| Methods inherited from class net.sf.molae.pipe.genimpl.KeySetBasedMap |
|---|
clear, containsKey, entrySet, size |
| Methods inherited from class java.util.AbstractMap |
|---|
clone, containsValue, equals, hashCode, isEmpty, putAll, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ListBackedMap(List<K> universe,
List<V> values)
universe - a collection containing all possible keysvalues - values of the mappublic ListBackedMap(List<K> universe)
universe - a collection containing all possible keys
NullPointerException - if the specified object is nullpublic ListBackedMap(Set<K> universe)
universe - a collection containing all possible keys
NullPointerException - if the specified object is null| Method Detail |
|---|
public static <V> Map<Integer,V> listAsMap(List<V> base)
base - the base list.
public V get(Object key)
KeySetBasedMap
get in interface Map<K,V>get in class KeySetBasedMap<K,V>key - key whose associated value is to be returned.
public V put(K key,
V value)
put in interface Map<K,V>put in class AbstractMap<K,V>public V remove(Object key)
KeySetBasedMapThis implementation removes the specified key from the keySet().
remove in interface Map<K,V>remove in class KeySetBasedMap<K,V>key - key whose mapping is to be removed from the map.
public Set<K> keySet()
KeySetBasedMap
keySet in interface Map<K,V>keySet in class KeySetBasedMap<K,V>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||