|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<K,V>
org.aspsimon.termcomp.infrastructure.utility.AutoHashMap<K,V>
public class AutoHashMap<K,V>
This class extends HashMap to add the functionality for inserting
default values into the map if the requested key does not already exist.
The default value, if none is set is null, the user is required to
set his own default value if she wants to use something else. Of course, this
value should be of the type V.
| Constructor Summary | |
|---|---|
AutoHashMap()
Default constructor. |
|
AutoHashMap(V defVal)
Constructs a new AutoHashMap setting a default value. |
|
| Method Summary | |
|---|---|
V |
get(java.lang.Object key)
Gets a value from the Map. |
V |
getDefVal()
Get the default value set for this map. |
void |
setDefVal(V defVal)
Set the default value for initializing new elements in this map. |
| Methods inherited from class java.util.HashMap |
|---|
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public AutoHashMap()
V.
public AutoHashMap(V defVal)
AutoHashMap setting a default value.
defVal - The default value to set.| Method Detail |
|---|
public V get(java.lang.Object key)
Map. If the key does not exist, it is
added to the map and the default value is returned.
get in interface java.util.Map<K,V>get in class java.util.HashMap<K,V>key - The key whose associated value is to be returned.
public V getDefVal()
V.
public void setDefVal(V defVal)
defVal - The default value.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||