Java – HashMap

Java – HashMap

HashMap stores items pairs, key-value pairs. You can find it in other languages with other names such as hashtable, dictionary, associative array etc. HashMap is unordered but it is very fast. Every key is unique. The keys and values should not be primitive types. HashMap implements the Map interface and it is recommended to declare a HashMap object using the Map interface for future changes. Common methods: put(K key, V value) get(Object key) remove(Object key) size() isEmpty() clear() containsKey(Object key) containsValue(Object value) Please notice that HashMap is not a collection, so no iterator is provided. You…

Java – HashMap Read More