de.lmu.ifi.dbs.elki.utilities
Class AnyMap<K>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,Object>
de.lmu.ifi.dbs.elki.utilities.AnyMap<K>
- Type Parameters:
K
- Key class type
- All Implemented Interfaces:
- Serializable, Cloneable, Map<K,Object>
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.
The use of the inherited get(Object)
method is depreciated.
- Author:
- Erich Schubert
- See Also:
- Serialized Form
Constructor Summary |
AnyMap()
Constructor |
Method Summary |
|
get(K key,
Class<T> restriction)
Type checked get method |
Object |
get(Object key)
Deprecated. |
|
getGenerics(K key,
Class<?> restriction)
(Largely) type checked get method for use with generic types |
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.
- Depreciate the use of the untyped get method.
- Specified by:
get
in interface Map<K,Object>
- Overrides:
get
in class HashMap<K,Object>