can you explain the set in hashmap? and without implement set interface how we can use it?
Doubt related set
Set<Map.Entry<String, Integer>> enteries =map.entrySet(); explain this also?
Hi @Mansi,
Actually that function is used to add all the <integer ,boolean> pair in the hashmap to a set entries . Then we run a for loop in the set to take each pair one by one and then check if the boolean value is true we add the number to the array list … And without implementing the set interface you can use it by importing from java.util. A ready made set interface is made and store you can import it by using the line import java.util.* …
Set<Map.Entry<String, Integer>> enteries =map.entrySet();
Here the Set is the keyword to make the set … Then on the right hand side of equal the map.entrySet() is a predefined function in map datastructure which returns a set . And inside the Set we declare what type of set do we need.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.