de.lmu.ifi.dbs.elki.utilities.datastructures
Class AnyMap<K>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,Object>
de.lmu.ifi.dbs.elki.utilities.datastructures.AnyMap<K>
- Type Parameters:
K
- Key class type
- All Implemented Interfaces:
- Serializable, Cloneable, Map<K,Object>
- Direct Known Subclasses:
- VisualizationTask, VisualizerContext
public class AnyMap<K>
- extends HashMap<K,Object>
Associative storage based on a HashMap
for multiple object types that
offers a type checked get(Object, Class)
method.
- See Also:
- Serialized Form
Constructor Summary |
AnyMap()
Constructor |
Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
serialVersionUID
private static final long serialVersionUID
- Serial version.
- See Also:
- Constant Field Values
AnyMap
public AnyMap()
- Constructor
get
public <T> T get(K key,
Class<T> restriction)
- Type checked get method
- Type Parameters:
T
- Return type- Parameters:
key
- Keyrestriction
- restriction class
- Returns:
- Object that is guaranteed to be of class restriction or null
getGenerics
public <T> T getGenerics(K key,
Class<?> restriction)
- (Largely) type checked get method for use with generic types
- Type Parameters:
T
- Return type- Parameters:
key
- Keyrestriction
- restriction class
- Returns:
- Object that is guaranteed to be of class restriction or null
get
@Deprecated
public Object get(Object key)
- Deprecated. use
get(Object, Class)
or
getGenerics(Object, Class)
instead, for type safety!
- Depreciate the use of the untyped get method.
- Specified by:
get
in interface Map<K,Object>
- Overrides:
get
in class HashMap<K,Object>