List of usage examples for java.util.concurrent ConcurrentHashMap reduceEntries
public Map.Entry<K, V> reduceEntries(long parallelismThreshold, BiFunction<Map.Entry<K, V>, Map.Entry<K, V>, ? extends Map.Entry<K, V>> reducer)
From source file:Main.java
public static <K, V extends Comparable> K getKeyOfMaxValue(ConcurrentHashMap<K, V> map) { Map.Entry<K, V> entry = map.reduceEntries(1000, (oldEntry, newEntry) -> { if (oldEntry.getValue().compareTo(newEntry.getValue()) > 0) return oldEntry; else/*w w w .j av a 2 s .c om*/ return newEntry; }); return entry.getKey(); }