|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fourthline.cling.support.shared.AbstractMap<K,V>
public abstract class AbstractMap<K,V>
A base class for Map
implementations.
Subclasses that permit new mappings to be added must override put(K, V)
.
The default implementations of many methods are inefficient for large
maps. For example in the default implementation, each call to get(java.lang.Object)
performs a linear iteration of the entry set. Subclasses should override such
methods to improve their performance.
Nested Class Summary | |
---|---|
static class |
AbstractMap.SimpleEntry<K,V>
A key-value mapping with mutable values. |
static class |
AbstractMap.SimpleImmutableEntry<K,V>
An immutable key-value mapping. |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Constructor Summary | |
---|---|
protected |
AbstractMap()
|
Method Summary | |
---|---|
void |
clear()
|
protected Object |
clone()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
abstract 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()
|
String |
toString()
|
Collection<V> |
values()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AbstractMap()
Method Detail |
---|
public void clear()
This implementation calls entrySet().clear()
.
clear
in interface Map<K,V>
public boolean containsKey(Object key)
This implementation iterates its key set, looking for a key that
key
equals.
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
This implementation iterates its entry set, looking for an entry with
a value that value
equals.
containsValue
in interface Map<K,V>
public abstract Set<Map.Entry<K,V>> entrySet()
entrySet
in interface Map<K,V>
public boolean equals(Object object)
This implementation first checks the structure of object
. If
it is not a map or of a different size, this returns false. Otherwise it
iterates its own entry set, looking up each entry's key in object
. If any value does not equal the other map's value for the same
key, this returns false. Otherwise it returns true.
equals
in interface Map<K,V>
equals
in class Object
public V get(Object key)
This implementation iterates its entry set, looking for an entry with
a key that key
equals.
get
in interface Map<K,V>
public int hashCode()
This implementation iterates its entry set, summing the hashcodes of its entries.
hashCode
in interface Map<K,V>
hashCode
in class Object
public boolean isEmpty()
This implementation compares size()
to 0.
isEmpty
in interface Map<K,V>
public Set<K> keySet()
This implementation returns a view that calls through this to map. Its iterator transforms this map's entry set iterator to return keys.
keySet
in interface Map<K,V>
public V put(K key, V value)
This base implementation throws UnsupportedOperationException
.
put
in interface Map<K,V>
public void putAll(Map<? extends K,? extends V> map)
This implementation iterates through map
's entry set, calling
put()
for each.
putAll
in interface Map<K,V>
public V remove(Object key)
This implementation iterates its entry set, removing the entry with
a key that key
equals.
remove
in interface Map<K,V>
public int size()
This implementation returns its entry set's size.
size
in interface Map<K,V>
public String toString()
This implementation composes a string by iterating its entry set. If this map contains itself as a key or a value, the string "(this Map)" will appear in its place.
toString
in class Object
public Collection<V> values()
This implementation returns a view that calls through this to map. Its iterator transforms this map's entry set iterator to return values.
values
in interface Map<K,V>
protected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |