DthingApi
|
Classes | |
interface | Entry |
Public Member Functions | |
void | clear () |
boolean | containsKey (Object key) |
boolean | containsValue (Object value) |
Set< Map.Entry< K, V > > | entrySet () |
boolean | equals (Object object) |
V | get (Object key) |
int | hashCode () |
boolean | isEmpty () |
Set< K > | keySet () |
V | put (K key, V value) |
void | putAll (Map<? extends K,? extends V > map) |
V | remove (Object key) |
int | size () |
Collection< V > | values () |
A
is a data structure consisting of a set of keys and values in which each key is mapped to a single value. The class of the objects used as keys is declared when the
is declared, as is the class of the corresponding values.
A
provides helper methods to iterate through all of the keys contained in it, as well as various methods to access and update the key/value pairs.
void java.util.Map< K, V >.clear | ( | ) |
Removes all elements from this
, leaving it empty.
UnsupportedOperationException | if removing elements from this Map |
Implemented in java.util.LinkedHashMap< K, V >, java.util.Hashtable< K, V >, java.util.HashMap< K, V >, and java.util.AbstractMap< K, V >.
boolean java.util.Map< K, V >.containsKey | ( | Object | key | ) |
Returns whether this
contains the specified key.
key | the key to search for. |
Implemented in java.util.HashMap< K, V >, java.util.Hashtable< K, V >, and java.util.AbstractMap< K, V >.
boolean java.util.Map< K, V >.containsValue | ( | Object | value | ) |
Returns whether this
contains the specified value.
value | the value to search for. |
Implemented in java.util.HashMap< K, V >, java.util.Hashtable< K, V >, java.util.LinkedHashMap< K, V >, and java.util.AbstractMap< K, V >.
Set<Map.Entry<K,V> > java.util.Map< K, V >.entrySet | ( | ) |
Returns a
containing all of the mappings in this
. Each mapping is an instance of Map.Entry. As the
is backed by this
, changes in one will be reflected in the other.
Implemented in java.util.Hashtable< K, V >, java.util.LinkedHashMap< K, V >, java.util.HashMap< K, V >, and java.util.AbstractMap< K, V >.
boolean java.util.Map< K, V >.equals | ( | Object | object | ) |
Compares the argument to the receiver, and returns
if the specified object is a
and both
s contain the same mappings.
object | the Object Object |
Implemented in java.util.Hashtable< K, V >, and java.util.AbstractMap< K, V >.
V java.util.Map< K, V >.get | ( | Object | key | ) |
Returns the value of the mapping with the specified key.
key | the key. |
Implemented in java.util.HashMap< K, V >, java.util.LinkedHashMap< K, V >, java.util.AbstractMap< K, V >, and java.util.Hashtable< K, V >.
int java.util.Map< K, V >.hashCode | ( | ) |
Returns an integer hash code for the receiver.
s which are equal return the same value for this method.
Implemented in java.util.Hashtable< K, V >, and java.util.AbstractMap< K, V >.
boolean java.util.Map< K, V >.isEmpty | ( | ) |
Returns whether this map is empty.
Implemented in java.util.HashMap< K, V >, java.util.AbstractMap< K, V >, and java.util.Hashtable< K, V >.
Set<K> java.util.Map< K, V >.keySet | ( | ) |
Returns a set of the keys contained in this
. The
is backed by this
so changes to one are reflected by the other. The
does not support adding.
Implemented in java.util.Hashtable< K, V >, java.util.HashMap< K, V >, java.util.LinkedHashMap< K, V >, and java.util.AbstractMap< K, V >.
V java.util.Map< K, V >.put | ( | K | key, |
V | value | ||
) |
Maps the specified key to the specified value.
key | the key. |
value | the value. |
UnsupportedOperationException | if adding to this Map |
ClassCastException | if the class of the key or value is inappropriate for this Map |
IllegalArgumentException | if the key or value cannot be added to this Map |
NullPointerException | if the key or value is null Map null |
Implemented in java.util.HashMap< K, V >, java.util.AbstractMap< K, V >, java.util.Hashtable< K, V >, and java.util.LinkedHashMap< K, V >.
void java.util.Map< K, V >.putAll | ( | Map<? extends K,? extends V > | map | ) |
Copies every mapping in the specified
to this
.
map | the Map |
UnsupportedOperationException | if adding to this Map |
ClassCastException | if the class of a key or a value of the specified Map Map |
IllegalArgumentException | if a key or value cannot be added to this Map |
NullPointerException | if a key or value is null Map null |
V java.util.Map< K, V >.remove | ( | Object | key | ) |
Removes a mapping with the specified key from this
.
key | the key of the mapping to remove. |
UnsupportedOperationException | if removing from this Map |
Implemented in java.util.HashMap< K, V >, java.util.LinkedHashMap< K, V >, java.util.Hashtable< K, V >, and java.util.AbstractMap< K, V >.
int java.util.Map< K, V >.size | ( | ) |
Returns the number of mappings in this
.
Implemented in java.util.HashMap< K, V >, java.util.AbstractMap< K, V >, and java.util.Hashtable< K, V >.
Collection<V> java.util.Map< K, V >.values | ( | ) |
Returns a
of the values contained in this
. The
is backed by this
so changes to one are reflected by the other. The
supports Collection#remove, Collection#removeAll, Collection#retainAll, and Collection#clear operations, and it does not support Collection#add or Collection#addAll operations.
This method returns a
which is the subclass of AbstractCollection. The AbstractCollection#iterator method of this subclass returns a "wrapper object" over the iterator of this
's entrySet(). The AbstractCollection#size method wraps this
's size method and the AbstractCollection#contains method wraps this
'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.
Implemented in java.util.HashMap< K, V >, java.util.Hashtable< K, V >, java.util.LinkedHashMap< K, V >, and java.util.AbstractMap< K, V >.