gov.llnl.ontology.util
Class ExtendedMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
gov.llnl.ontology.util.ExtendedMap<K,V>
- All Implemented Interfaces:
- Map<K,V>
public class ExtendedMap<K,V>
- extends AbstractMap<K,V>
A Map
that extends an existing map without modifying the underlying
map. Given an existing Map
, this class will provide read only access
to the elements in the Map
and store all new key, value pairs in a
new internal Map
.
This class is extremely useful for when several different maps need to share
a set of mappings provided by a base map, but duplicate copies of the map
cannot be created, due to memory constraints.
- Author:
- Keith Stevens
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
Methods inherited from class java.util.AbstractMap |
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, size, toString, values |
ExtendedMap
public ExtendedMap(Map<K,V> baseMap)
- Creates a new
ExtendedMap
that wraps the given Map
. All
new mappings will be stored in a new map so that baseMap
is never
modified.
entrySet
public Set<Map.Entry<K,V>> entrySet()
-
- Specified by:
entrySet
in interface Map<K,V>
- Specified by:
entrySet
in class AbstractMap<K,V>
get
public V get(Object key)
-
- Specified by:
get
in interface Map<K,V>
- Overrides:
get
in class AbstractMap<K,V>
put
public V put(K key,
V value)
-
- Specified by:
put
in interface Map<K,V>
- Overrides:
put
in class AbstractMap<K,V>
Copyright © 2010-2011. All Rights Reserved.