1 Jan 2025
1 Jan 2025
Keys are unique in Map interface, duplicate keys are not allowed but
duplicate values are allowed.
Each key can map to at most one value.
boolean containsKey Returns true if this map contains a mapping for the
(Object key); specified key.
boolean containsValue Returns true if this map maps one or more keys to the
(Object value); specified value
V get(Object key) Returns the value to which the specified key is mapped
V put(K key, V value) Associates the specified value with the specified key in
this map
V remove(Object key) Removes the mapping for a key from this map if it is
present
Set<K> keySet() Returns a Set view of the keys contained in this map
HashMap:
HashMap is available since jdk1.2V.
It allows duplicate values with unique keys & insertion order is not
maintained. (Duplicate keys are replaced)
Default capacity is 16 & load factor is 0.75.