All Packages Class Hierarchy This Package Previous Next Index
Interface util.SimpleMap
- public interface SimpleMap
An object that maps keys to values. It cannot contain duplicate keys, i.e.
each key can map to at most one value. Values equal null are supported.
Keys are tested for equality by their equals(Object) methods.
-
containsKey(Object)
- Returns true if this map contains a key equal to this key.
-
get(Object)
- Returns the object associated with the given key or null if no
such key is stored.
-
isEmpty()
- Returns true if this map contains no key-value mappings.
-
put(Object, Object)
- Insert the given key-value pair into the map.
-
size()
- Return the number of keys currently stored.
isEmpty
public abstract boolean isEmpty()
- Returns true if this map contains no key-value mappings.
- Returns:
- true if and only if this map contains no key-value mappings.
size
public abstract int size()
- Return the number of keys currently stored.
- Returns:
- number of keys.
containsKey
public abstract boolean containsKey(Object key)
- Returns true if this map contains a key equal to this key.
- Returns:
- true if and only if this map contains a key equal to this key.
get
public abstract Object get(Object key)
- Returns the object associated with the given key or null if no
such key is stored. The object is not removed from the map.
Note: A return value of null does not necessarily mean that there
is no mapping for this key; it is also possible that the value
associated with the key is meant to be null. Use
containsKey
if you need to distinguish these two cases.
- Parameters:
- key - whose associated value is to be returned.
- Returns:
- the value to which this map maps the specified key, or null if the map contains no mapping for this key.
put
public abstract void put(Object key,
Object value)
- Insert the given key-value pair into the map. If the map previously contained
a mapping for this key, the old value is replaced.
The value is allowed to be null whereas the key is not.
- Parameters:
- key - key with which the specified value is to be associated.
- value - value to be associated with the specified key.
- Throws: NullPointerException
- if key is null.
All Packages Class Hierarchy This Package Previous Next Index