What is Map

What is Map

What is Map Answer: Map is an interface which maps unique keys with its values. Key is object which you will use to retrieve value later time. Using key and value pair you store value in the Map object and once … Continue reading

What is EntrySet View

What is EntrySet View

What is EntrySet View Answer: entrySet view is method in HashMap class and its signature is below: public Set<Map.Entry<K,V>> entrySet() This method returns Set view of mappings that is contained in the map

What is KeySet View

What is KeySet View

What is KeySet View Answer: keySet view is method in HashMap class. This method returns Set view of all keys that is contained in map. Below is important point of KeySet: Any chages in the map will be reflected to … Continue reading

Difference between HashSet and TreeSet

Difference between HashSet and TreeSet

Difference between HashSet and TreeSet Answer: Below are difference between HashSet and TreeSet: HashSet TreeSet HashSet elements order is not constant overtime TreeSet guarantees elements will be ordered by their natural ordering or you could specify using its constructor