| java.lang.Object java.util.AbstractMap
AbstractMap | abstract public class AbstractMap implements Map<K, V>(Code) | | AbstractMap is an abstract implementation of the Map interface. This
implementation does not support adding. A subclass must implement the
abstract method entrySet().
since: 1.2 |
Constructor Summary | |
protected | AbstractMap() Constructs a new instance of this AbstractMap. |
Method Summary | |
public void | clear() Removes all elements from this Map, leaving it empty. | protected Object | clone() Answers a new instance of the same class as the receiver, whose slots
have been filled in with the values in the slots of the receiver. | public boolean | containsKey(Object key) Searches this Map for the specified key. | public boolean | containsValue(Object value) Searches this Map for the specified value. | abstract public Set<Map.Entry<K, V>> | entrySet() Returns a Set of Map.Entry s that represent the entries in
this Map. | public boolean | equals(Object object) Compares the specified object to this Map and answer if they are equal. | public V | get(Object key) Answers the value of the mapping with the specified key. | public int | hashCode() Answers an integer hash code for the receiver. | public boolean | isEmpty() Answers if this Map has no elements, a size of zero. | public Set<K> | keySet() Answers a Set of the keys contained in this Map. | public V | put(K key, V value) Maps the specified key to the specified value. | public void | putAll(Map<? extends K, ? extends V> map) Copies every mapping in the specified Map to this Map. | public V | remove(Object key) Removes a mapping with the specified key from this Map. | public int | size() Answers the number of elements in this Map. | public String | toString() Answers the string representation of this Map. | public Collection<V> | values() Answers a collection of the values contained in this map. |
AbstractMap | protected AbstractMap()(Code) | | Constructs a new instance of this AbstractMap.
|
clone | protected Object clone() throws CloneNotSupportedException(Code) | | Answers a new instance of the same class as the receiver, whose slots
have been filled in with the values in the slots of the receiver.
Object a shallow copy of this object. exception: CloneNotSupportedException - if the receiver's class does not implement the interfaceCloneable. |
containsKey | public boolean containsKey(Object key)(Code) | | Searches this Map for the specified key.
Parameters: key - the object to search for true if key is a key of this Map, false otherwise |
containsValue | public boolean containsValue(Object value)(Code) | | Searches this Map for the specified value.
Parameters: value - the object to search for true if value is a value of this Map, falseotherwise |
entrySet | abstract public Set<Map.Entry<K, V>> entrySet()(Code) | | Returns a Set of Map.Entry s that represent the entries in
this Map. Making changes to this Set will change the original Map and
vice-versa. Entries can be removed from the Set, or their values can be
changed, but new entries cannot be added to the Set.
a Set of Map.Entry s representing the entries inthis Map |
equals | public boolean equals(Object object)(Code) | | Compares the specified object to this Map and answer if they are equal.
The object must be an instance of Map and contain the same key/value
pairs.
Parameters: object - the object to compare with this object true if the specified object is equal to this Map, falseotherwise See Also: AbstractMap.hashCode |
get | public V get(Object key)(Code) | | Answers the value of the mapping with the specified key.
Parameters: key - the key the value of the mapping with the specified key |
hashCode | public int hashCode()(Code) | | Answers an integer hash code for the receiver. Objects which are equal
answer the same value for this method.
the receiver's hash See Also: AbstractMap.equals |
isEmpty | public boolean isEmpty()(Code) | | Answers if this Map has no elements, a size of zero.
true if this Map has no elements, false otherwise See Also: AbstractMap.size |
keySet | public Set<K> keySet()(Code) | | Answers a Set of the keys contained in this Map. The set is backed by
this Map so changes to one are reflected by the other. The set does not
support adding.
a Set of the keys |
put | public V put(K key, V value)(Code) | | Maps the specified key to the specified value.
Parameters: key - the key Parameters: value - the value the value of any previous mapping with the specified key or nullif there was no mapping exception: UnsupportedOperationException - when adding to this Map is not supported exception: ClassCastException - when the class of the key or value is inappropriate forthis Map exception: IllegalArgumentException - when the key or value cannot be added to this Map exception: NullPointerException - when the key or value is null and this Map does notsupport null keys or values |
putAll | public void putAll(Map<? extends K, ? extends V> map)(Code) | | Copies every mapping in the specified Map to this Map.
Parameters: map - the Map to copy mappings from exception: UnsupportedOperationException - when adding to this Map is not supported exception: ClassCastException - when the class of a key or value is inappropriate for thisMap exception: IllegalArgumentException - when a key or value cannot be added to this Map exception: NullPointerException - when a key or value is null and this Map does not supportnull keys or values |
remove | public V remove(Object key)(Code) | | Removes a mapping with the specified key from this Map.
Parameters: key - the key of the mapping to remove the value of the removed mapping or null if key is not a key inthis Map exception: UnsupportedOperationException - when removing from this Map is not supported |
size | public int size()(Code) | | Answers the number of elements in this Map.
the number of elements in this Map |
toString | public String toString()(Code) | | Answers the string representation of this Map.
the string representation of this Map |
values | public Collection<V> values()(Code) | | Answers a collection of the values contained in this map. The collection
is backed by this map so changes to one are reflected by the other. The
collection supports remove, removeAll, retainAll and clear operations,
and it does not support add or addAll operations.
This method answers a collection which is the subclass of
AbstractCollection. The iterator method of this subclass answers a
"wrapper object" over the iterator of map's entrySet(). The size method
wraps the map's size method and the contains method wraps the map's
containsValue method.
The collection is created when this method is called at first time and
returned in response to all subsequent calls. This method may return
different Collection when multiple calls to this method, since it has no
synchronization performed.
a collection of the values contained in this map |
|
|