Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Java HashMap Methods

HashMap Basic methods

Object get (Object key)
Returns the value mapped to the specified key, or null if no entry is found.

Object put (Object key, Object value)
Maps the specified key to the specified value in this HashMap and returns the value previously associated with the specified key, if any. Otherwise, it returns the null value.

Object remove (Object key)
Removes the key and its associated value from the HashMap, and returns the value previously associated with the specified key, if any. Otherwise, it returns the null value.

boolean containsKey(Object key)
Returns true if the specified key is mapped to some value in the map, otherwise false.

boolean containsValue(Object value)
Returns true if there are one or more keys mapped to the specified value, otherwise false.

int size()
Returns the size of the HashMap.

boolean isEmpty()
returns true if HashMap is empty, otherwise false.


<< HashMap Constructor    HashMap Operations >>
Your rating: None Average: 3.5 (2 votes)
Share this

Post new comment