public abstract class AbstractMap<K,V> extends Object implements Map<K,V>
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractMap.SimpleEntry<K,V>
A key-value mapping with mutable values.
|
static class |
AbstractMap.SimpleImmutableEntry<K,V>
An immutable key-value mapping.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMap() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
This implementation calls
entrySet().clear(). |
protected Object |
clone() |
boolean |
containsKey(Object key)
This implementation iterates its key set, looking for a key that
key equals. |
boolean |
containsValue(Object value)
This implementation iterates its entry set, looking for an entry with
a value that
value equals. |
abstract Set<Map.Entry<K,V>> |
entrySet() |
boolean |
equals(Object object)
This implementation first checks the structure of
object. |
V |
get(Object key)
This implementation iterates its entry set, looking for an entry with
a key that
key equals. |
int |
hashCode()
This implementation iterates its entry set, summing the hashcodes of
its entries.
|
boolean |
isEmpty()
This implementation compares
size() to 0. |
Set<K> |
keySet()
This implementation returns a view that calls through this to map.
|
V |
put(K key,
V value)
This base implementation throws
UnsupportedOperationException. |
void |
putAll(Map<? extends K,? extends V> map)
This implementation iterates through
map's entry set, calling
put() for each. |
V |
remove(Object key)
This implementation iterates its entry set, removing the entry with
a key that
key equals. |
int |
size()
This implementation returns its entry set's size.
|
String |
toString()
This implementation composes a string by iterating its entry set.
|
Collection<V> |
values()
This implementation returns a view that calls through this to map.
|
finalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic void clear()
This implementation calls entrySet().clear().
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 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.
public V get(Object key)
This implementation iterates its entry set, looking for an entry with
a key that key equals.
public int hashCode()
This implementation iterates its entry set, summing the hashcodes of its entries.
public boolean isEmpty()
This implementation compares size() to 0.
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.
public void putAll(Map<? extends K,? extends V> map)
This implementation iterates through map's entry set, calling
put() for each.
public V remove(Object key)
This implementation iterates its entry set, removing the entry with
a key that key equals.
public int size()
This implementation returns its entry set's size.
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.
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.
protected Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionCopyright © 2023 jUPnP.org. All rights reserved.