Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

Map Interface


A map contains values on the basis of key i.e. key and value pair. Each key and value pair is known as an entry. Map contains only unique keys.

Map is useful if you have to search, update or delete elements on the basis of key.

Useful methods of Map interface

Method Description
public Object put(Object key, Object value) is used to insert an entry in this map.
public void putAll(Map map) is used to insert the specified map in this map.
public Object remove(Object key) is used to delete an entry for the specified key.
public Object get(Object key) is used to return the value for the specified key.
public boolean containsKey(Object key) is used to search the specified key from this map.
public Set keySet() returns the Set view containing all the keys.
public Set entrySet() returns the Set view containing all the keys and values.

Entry Interface

Entry is the subinterface of Map. So we will be accessed it by Map.Entry name. It provides methods to get key and value.

Methods of Map.Entry interface

  1. public Object getKey(): is used to obtain key.
  2. public Object getValue():is used to obtain value.

Comments

comments