Computer Science, asked by SaiShivanee1955, 1 year ago

How to find the max value less than a value k in hash set in jva

Answers

Answered by Anonymous
0

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 keySet() or values(), depending upon whether you want maximum key, or maximum value.

Also, if you want as such, you can use a TreeSet and TreeMap instead, that stores the elements in sorted key order.

Similar questions