Find the Biggest number in HashSet/HashMap java

后端 未结 8 2180
我在风中等你
我在风中等你 2020-12-29 04:48

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 Ha

8条回答
  •  天命终不由人
    2020-12-29 05:30

    Consider using Apache Commons Math. Here is the API docs.
    The class of interest is SummaryStatistics. It works with doubles and computes max, min, mean etc. on the fly (as you add values to it). The data values are not stored in memory, so this class can be used to compute statistics for very large data streams.

提交回复
热议问题