Klasse AbstractMap<K,V>
- Alle implementierten Schnittstellen:
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.
- Seit:
- 1.2
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic classA key-value mapping with mutable values.static classAn immutable key-value mapping. -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Von Klasse geerbte Methoden java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitVon Schnittstelle geerbte Methoden java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Konstruktordetails
-
AbstractMap
protected AbstractMap()
-
-
Methodendetails
-
clear
public void clear()This implementation calls
entrySet().clear(). -
containsKey
This implementation iterates its key set, looking for a key that
keyequals.- Angegeben von:
containsKeyin SchnittstelleMap<K,V>
-
containsValue
This implementation iterates its entry set, looking for an entry with a value that
valueequals.- Angegeben von:
containsValuein SchnittstelleMap<K,V>
-
entrySet
-
equals
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 inobject. If any value does not equal the other map's value for the same key, this returns false. Otherwise it returns true. -
get
This implementation iterates its entry set, looking for an entry with a key that
keyequals. -
hashCode
public int hashCode()This implementation iterates its entry set, summing the hashcodes of its entries.
-
isEmpty
public boolean isEmpty()This implementation compares
size()to 0. -
keySet
This implementation returns a view that calls through this to map. Its iterator transforms this map's entry set iterator to return keys.
-
put
This base implementation throws
UnsupportedOperationException. -
putAll
This implementation iterates through
map's entry set, callingput()for each. -
remove
This implementation iterates its entry set, removing the entry with a key that
keyequals. -
size
public int size()This implementation returns its entry set's size.
-
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.
-
values
This implementation returns a view that calls through this to map. Its iterator transforms this map's entry set iterator to return values.
-
clone
- Setzt außer Kraft:
clonein KlasseObject- Löst aus:
CloneNotSupportedException
-