HashMap - useful methods
by , 11-01-2011 at 05:24 PM (421 Views)
I will present few important methods of HashMap class in this post.
The most useful methods are: get and put.
get(Object key) returns the value associated with specified key. It returns null if there is no value for this key.
put(K key, V value) associates the specified value with the specified key.
Other useful methods are:
containsKey(Object key) - (boolean) returns true if this map contains a value for the specified key
values() - returns a collection of the values contained in this map
keySet() - returns a set view of the keys contained in this map
remove(Object key) - removes the mapping for key from this map if present
isEmpty() - (boolean) returns true if this map contains no key-value mappings









Email Blog Entry
Size Reduced for Images in PDF &...
05-15-2013, 05:53 PM in Java Software