Here you can find the source of max(ConcurrentHashMap
public static Map.Entry<String, Long> max(ConcurrentHashMap<String, Long> map)
//package com.java2s; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class Main { public static Map.Entry<String, Long> max(ConcurrentHashMap<String, Long> map) { return map.reduceEntries(10, (e1, e2) -> { return e1.getValue() > e2.getValue() ? e1 : e2; });// w w w. j ava 2 s. c om } }