public class StackedMap extends MapWrapper
Modifier | Constructor and Description |
---|---|
|
StackedMap()
Initialize the new instance with default values.
|
|
StackedMap(java.util.Map map)
Initialize the new instance with an internal map.
|
protected |
StackedMap(StackedMap parent,
java.util.Map valueMap)
Initialize the new instance with a parent and a value map.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all entries from this map, but not from the maps on the stack!
|
boolean |
containsKey(java.lang.Object key)
This method returns true, if the given key can be found in this map or
any map on the stack.
|
boolean |
containsValue(java.lang.Object value)
This method returns true, if the given value is a value of any entry
in this map or any map on the stack.
|
protected java.util.Map |
createEmptyMap()
Subclasses may override this method to provide an instance of a different
implementation class than HashMap.
|
java.util.Set |
entrySet()
Returns all entries of the map and all stacked maps.
|
java.lang.Object |
get(java.lang.Object key)
Returns the object that was registered under the specified key in this
map or in any of the maps on the stack.
|
protected boolean |
hasParent() |
boolean |
isEmpty()
Returns true, if there is no entry in this map and in all maps on the stack.
|
java.util.Set |
keySet()
Returns all keys in this map and the maps on the stack
|
protected StackedMap |
parentMap() |
protected void |
parentMap(StackedMap newValue) |
java.util.Map |
pop()
Removes the map at the top of this stack and returns that map
as the value of this function.
|
void |
push()
Pushes the an newly created map onto the top of this stack.
|
void |
push(java.util.Map map)
Pushes the given map onto the top of this stack.
|
int |
size()
Returns how many entries currently are in this map and the maps on the
stack.
|
java.util.Collection |
values()
Returns all values of this map and the maps on the stack.
|
createEmptyMap, internalMap, internalMap, put, putAll, remove
public StackedMap()
public StackedMap(java.util.Map map)
protected StackedMap(StackedMap parent, java.util.Map valueMap)
public void clear()
clear
in interface java.util.Map
clear
in class MapWrapper
Map.clear()
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
containsKey
in class MapWrapper
Map.containsKey(Object)
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
containsValue
in class MapWrapper
Map.containsValue(Object)
public java.util.Set entrySet()
entrySet
in interface java.util.Map
entrySet
in class MapWrapper
Map.entrySet()
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
get
in class MapWrapper
Map.get(Object)
public boolean isEmpty()
isEmpty
in interface java.util.Map
isEmpty
in class MapWrapper
Map.isEmpty()
public java.util.Set keySet()
keySet
in interface java.util.Map
keySet
in class MapWrapper
Map.keySet()
public int size()
size
in interface java.util.Map
size
in class MapWrapper
Map.size()
public java.util.Collection values()
values
in interface java.util.Map
values
in class MapWrapper
Map.values()
public void push(java.util.Map map)
public void push()
public java.util.Map pop()
protected java.util.Map createEmptyMap()
createEmptyMap
in class MapWrapper
protected boolean hasParent()
protected StackedMap parentMap()
protected void parentMap(StackedMap newValue)