QA's approach 2 Java - Map Interface with Examples
Map Interface Used for storing key value pairs Linked HashMap: Will retain the Entries in the insertion order. HashMap: Will not retain the Entries in the insertion order. Methods in Map Interface: public Object put(Object key, Object value): This method is used to insert an entry in this map. public void putAll(Map map): This method is used to insert the specified map in this map. public Object remove(Object key): This method is used to delete an entry for the specified key. public Object get(Object key): This method is used to return the value for the specified key. public boolean containsKey(Object key): This method is used to search the specified key from this map. public Set keySet(): This method is used to return the Set view containing all the keys. public Set entrySet(): The entrySet( ) method declared by the Map interface returns a Set containing the map entries. Each ...