Java Code Examples for java.util.concurrent.ConcurrentHashMap.reduceValues()

The following are Jave code examples for showing how to use reduceValues() of the java.util.concurrent.ConcurrentHashMap class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: openjdk-jdk10   File:   Source Code and License Vote up 6 votes
 * reduceValuesInParallel accumulates across all values
public void testReduceValuesInParallel() {
    ConcurrentHashMap<Long, Long> m = longMap();
    Long r;
    r = m.reduceValues(1L, (Long x, Long y) -> Long.valueOf(x.longValue() + y.longValue()));
    assertEquals((long)r, (long)SIZE * (SIZE - 1));