Add elements in HashMap

We can use put() and putAll() methods of HashMap to add elements to HashMap Object put(Object key, Object value); Associates the specified value with the specified key in this map. This method is used to add single key-value pair to the HashMap Example import java.util.*; public class HashMapPutExample { public static void main(String args[]) { […]

Share this article on

HashMap overview

Its basically designed to store key value pairs HashMap class implements the Map interface and it is built using hashtable Main features of HashMap It stores data in the form of key-value pair Keys in the HashMap must be unique It allows one Null key and multiple Null values It does not maintain the order […]

Share this article on
< Previous Next >