I would like to find the biggest number in HashSet and HashMap. Say I have the number [22,6763,32,42,33] in my HashSet and I want to find the largest number in my current HashSet..how would i do this? and Same thing for the HashMap as well. I hope you can help me with it. Thank you.
You can use
Collections.max(Collection) to find the maximum element out of any collection.
Similarly, for a
HashMap, you can use the same method on its
values(), depending upon whether you want maximum key, or maximum value.