- clear()
public void clear()
Removes all mappings from the map.- clone()
public Object clone()
Returns a shallow copy of the HashMap.- compute()
public V compute(K key, BiFunction super K, ? super V, ? extends V> remappingFunction)
Attempts to compute a new mapping for the specified key.- computeIfAbsent()
public V computeIfAbsent(K key, Function super K, ? extends V> mappingFunction)
Computes and stores a value for the key if it is not already present.- computeIfPresent()
public V computeIfPresent(K key, BiFunction super K, ? super V, ? extends V> remappingFunction)
Updates the value only if the key is already present.- containsKey()
public boolean containsKey(Object key)
Checks if the map contains the specified key.- containsValue()
public boolean containsValue(Object value)
Checks if the map maps one or more keys to the specified value.- entrySet()
public Set> entrySet()
Returns a set view of the key-value mappings.- forEach()
public void forEach(BiConsumer super K, ? super V> action)
Performs an action for each entry in the map.- get()
public V get(Object key)
Returns the value to which the specified key is mapped, or null.- getOrDefault()
public V getOrDefault(Object key, V defaultValue)
Returns the value for the key, or a default if the key is not present.- isEmpty()
public boolean isEmpty()
Checks if the map contains no key-value mappings.- keySet()
public Set keySet()
Returns a Set view of the keys contained in the map.- merge()
public V merge(K key, V value, BiFunction super V, ? super V, ? extends V> remappingFunction)
Merges the value with existing value using a mapping function.- put()
public V put(K key, V value)
Associates the specified value with the specified key in the map.- putAll()
public void putAll(Map extends K, ? extends V> m)
Copies all of the mappings from the specified map to this map.- putIfAbsent()
public V putIfAbsent(K key, V value)
Puts the value only if the key is not already associated with a value.- remove()
public V remove(Object key)public boolean remove(Object key, Object value)
Removes the mapping for the specified key or key-value pair.- replace()
public V replace(K key, V value)public boolean replace(K key, V oldValue, V newValue)
Replaces the entry for the specified key if it is currently mapped.- replaceAll()
public void replaceAll(BiFunction super K, ? super V, ? extends V> function)
Replaces each entry’s value using the provided function.- size()
public int size()
Returns the number of key-value mappings in the map.- values()
public Collection values()
Returns a Collection view of the values contained in the map.
Comments
Loading comments...