hudson.plugins.violations.util
Class HashMapWithDefault<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
hudson.plugins.violations.util.HashMapWithDefault<K,V>
- Type Parameters:
K - the type of key for this map.V - the type of mapped value.
- All Implemented Interfaces:
- Serializable, Cloneable, Map<K,V>
public class HashMapWithDefault<K,V>
- extends HashMap<K,V>
An extension of a hash map with a default value for
keys not present.
- See Also:
- Serialized Form
|
Method Summary |
V |
get(Object k)
Get a value for a key. |
| Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
HashMapWithDefault
public HashMapWithDefault(V defaultValue)
- Construct a new hash map.
- Parameters:
defaultValue - the value to use if a key cannot be found.
get
public V get(Object k)
- Get a value for a key.
- Specified by:
get in interface Map<K,V>- Overrides:
get in class HashMap<K,V>
- Parameters:
k - the key to use to lookup the map.
- Returns:
- the value for the key, or the default value if the key
is not in the map.
Copyright © 2004-2012 Hudson. All Rights Reserved.