Type Parameters:
K - the type of keys maintained by this map
V - the type of mapped values
All Known Subinterfaces:
Bindings, ConcurrentMap<K,V>, ConcurrentNavigableMap<K,V>, NavigableMap<K,V>, SequencedMap<K,V>, SortedMap<K,V>
All Known Implementing Classes:
AbstractMap, Attributes, AuthProvider, ConcurrentHashMap, ConcurrentSkipListMap, EnumMap, HashMap, Hashtable, Headers, IdentityHashMap, LinkedHashMap, PrinterStateReasons, Properties, Provider, RenderingHints, SimpleBindings, TabularDataSupport, TreeMap, UIDefaults, WeakHashMap

  • Nested Class Summary

    Nested Classes

    static interface 

    A map entry (key-value pair).

  • Method Summary

    void

    clear()

    Removes all of the mappings from this map (optional operation).

    default V

    compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction)

    Attempts to compute a mapping for the specified key and its current mapped value, or null if there is no current mapping (optional operation).

    default V

    computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction)

    If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null (optional operation).

    default V

    computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction)

    If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value (optional operation).

    boolean

    Returns true if this map contains a mapping for the specified key.

    boolean

    Returns true if this map maps one or more keys to the specified value.

    static <K,V> Map<K,V>

    copyOf(Map<? extends K, ? extends V> map)

    Returns an unmodifiable Map containing the entries of the given Map.

    entry(K k, V v)

    Returns an unmodifiable Map.Entry containing the given key and value.

    entrySet()

    Returns a Set view of the mappings contained in this map.

    boolean

    Compares the specified object with this map for equality.

    default void

    Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.

    Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

    default V

    getOrDefault(Object key, V defaultValue)

    Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.

    int

    hashCode()

    Returns the hash code value for this map.

    boolean

    isEmpty()

    Returns true if this map contains no key-value mappings.

    keySet()

    Returns a Set view of the keys contained in this map.

    default V

    merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction)

    If the specified key is not already associated with a value or is associated with null, associates it with the given non-null value (optional operation).

    static <K,V> Map<K,V>

    of()

    Returns an unmodifiable map containing zero mappings.

    static <K,V> Map<K,V>

    of(K k1, V v1)

    Returns an unmodifiable map containing a single mapping.

    static <K,V> Map<K,V>

    of(K k1, V v1, K k2, V v2)

    Returns an unmodifiable map containing two mappings.

    static <K,V> Map<K,V>

    of(K k1, V v1, K k2, V v2, K k3, V v3)

    Returns an unmodifiable map containing three mappings.

    static <K,V> Map<K,V>

    of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)

    Returns an unmodifiable map containing four mappings.

    static <K,V> Map<K,V>

    of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)

    Returns an unmodifiable map containing five mappings.

    static <K,V> Map<K,V>

    of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6)

    Returns an unmodifiable map containing six mappings.

    static <K,V> Map<K,V>

    of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7)

    Returns an unmodifiable map containing seven mappings.

    static <K,V> Map<K,V>

    of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8)

    Returns an unmodifiable map containing eight mappings.

    static <K,V> Map<K,V>

    of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9)

    Returns an unmodifiable map containing nine mappings.

    static <K,V> Map<K,V>

    of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10)

    Returns an unmodifiable map containing ten mappings.

    static <K,V> Map<K,V>

    ofEntries(Map.Entry<? extends K, ? extends V>... entries)

    Returns an unmodifiable map containing keys and values extracted from the given entries.

    put(K key, V value)

    Associates the specified value with the specified key in this map (optional operation).

    void

    putAll(Map<? extends K, ? extends V> m)

    Copies all of the mappings from the specified map to this map (optional operation).

    default V

    putIfAbsent(K key, V value)

    If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns null, else returns the current value (optional operation).

    Removes the mapping for a key from this map if it is present (optional operation).

    default boolean

    Removes the entry for the specified key only if it is currently mapped to the specified value (optional operation).

    default V

    replace(K key, V value)

    Replaces the entry for the specified key only if it is currently mapped to some value (optional operation).

    default boolean

    replace(K key, V oldValue, V newValue)

    Replaces the entry for the specified key only if currently mapped to the specified value (optional operation).

    default void

    replaceAll(BiFunction<? super K, ? super V, ? extends V> function)

    Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception (optional operation).

    int

    size()

    Returns the number of key-value mappings in this map.

    values()

    Returns a Collection view of the values contained in this map.

  • Method Details

    • size

    • isEmpty

    • containsKey

    • containsValue

    • get

    • put

    • remove

    • putAll

    • clear

    • keySet

    • values

    • entrySet

    • equals

    • hashCode

    • getOrDefault

    • forEach

    • replaceAll

    • putIfAbsent

    • remove

    • replace

    • replace

    • computeIfAbsent

    • computeIfPresent

    • compute

    • merge

    • of

    • of

    • of

    • of

    • of

    • of

    • of

    • of

    • of

    • of

    • of

    • ofEntries

    • entry

    • copyOf