org.springframework.osgi.util
Class MapBasedDictionary
java.lang.Object
java.util.Dictionary
org.springframework.osgi.util.MapBasedDictionary
- All Implemented Interfaces:
- Map
public class MapBasedDictionary
- extends Dictionary
- implements Map
Dictionary implementation backed by a map instance. While the JDK provides a
Dictionary implementation through Hashtable, the class itself is always
synchronized and does not maintain the internal order.
This simple wrapper, accepts any type of Map as backing storage allowing
more options in chosing the approapriate implementation. By default, a
LinkedHashMap
is used, if no Map is specified.
This implementation will enforce the Dictionary behavior over the map
when it comes to handling null values. As opposed to a Map, the Dictionary
always throws NullPointerException
if a given argument is null.
- Author:
- Costin Leau
- See Also:
Map
,
Dictionary
Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
MapBasedDictionary
public MapBasedDictionary(Map map)
MapBasedDictionary
public MapBasedDictionary()
- Default constructor.
MapBasedDictionary
public MapBasedDictionary(int initialCapacity)
MapBasedDictionary
public MapBasedDictionary(Dictionary dictionary)
- Constructor for dealing with existing Dictionary. Will copy the content
into the inner Map.
- Parameters:
dictionary
-
MapBasedDictionary
public MapBasedDictionary(Map map,
Dictionary dictionary)
clear
public void clear()
- Specified by:
clear
in interface Map
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interface Map
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interface Map
entrySet
public Set entrySet()
- Specified by:
entrySet
in interface Map
get
public Object get(Object key)
- Specified by:
get
in interface Map
- Specified by:
get
in class Dictionary
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface Map
- Specified by:
isEmpty
in class Dictionary
keySet
public Set keySet()
- Specified by:
keySet
in interface Map
put
public Object put(Object key,
Object value)
- Specified by:
put
in interface Map
- Specified by:
put
in class Dictionary
putAll
public void putAll(Map t)
- Specified by:
putAll
in interface Map
putAll
public void putAll(Dictionary dictionary)
remove
public Object remove(Object key)
- Specified by:
remove
in interface Map
- Specified by:
remove
in class Dictionary
size
public int size()
- Specified by:
size
in interface Map
- Specified by:
size
in class Dictionary
values
public Collection values()
- Specified by:
values
in interface Map
elements
public Enumeration elements()
- Specified by:
elements
in class Dictionary
keys
public Enumeration keys()
- Specified by:
keys
in class Dictionary
toString
public String toString()
- Overrides:
toString
in class Object
equals
public boolean equals(Object obj)
- Specified by:
equals
in interface Map
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Specified by:
hashCode
in interface Map
- Overrides:
hashCode
in class Object
Copyright © 2006-2007 Spring Framework. All Rights Reserved.