Java Code Examples for java.util.concurrent.ConcurrentHashMap.reduceEntries()
The following are Jave code examples for showing how to use
reduceEntries() 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.
+ Save this method
Example 1
Project: openjdk-jdk10 File: ConcurrentHashMap8Test.java View Source Code | 6 votes |
/** * reduceEntriesSequentially accumulates across all entries */ public void testReduceEntriesSequentially() { ConcurrentHashMap<Long, Long> m = longMap(); Map.Entry<Long,Long> r; r = m.reduceEntries(Long.MAX_VALUE, new AddKeys()); assertEquals(r.getKey().longValue(), (long)SIZE * (SIZE - 1) / 2); }
Example 2
Project: openjdk-jdk10 File: ConcurrentHashMap8Test.java View Source Code | 6 votes |
/** * reduceEntriesInParallel accumulate across all entries */ public void testReduceEntriesInParallel() { ConcurrentHashMap<Long, Long> m = longMap(); Map.Entry<Long,Long> r; r = m.reduceEntries(1L, new AddKeys()); assertEquals(r.getKey().longValue(), (long)SIZE * (SIZE - 1) / 2); }