#
Map(Map don't allow duplicate key)
Types of Map:
- HashMap - unordered
- LinkedHashMap - ordered
- TreeMap (Sorted Map) - sorted by key
#
Instantiate#
Methods (map)put() - to insert/ update key,value pair in map
get() - to fetch the value of a key from map
remove() - to remove the pair from the map
size() - returns number of key/value pairs available in the map.
containsKey() - returns true if key is present in the map
containsValue() - returns true if value is present in the map
keySet() - returns set view of map of all keys
values() - It returns a Collection view of the values contained in this map.
entrySet() - method returns a complete set of keys and values present in the Map.
Traversing Map