Java Code Examples for java.util.concurrent.ConcurrentHashMap#reduceEntries()

The following examples show how to use java.util.concurrent.ConcurrentHashMap#reduceEntries() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
/**
 * 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
/**
 * 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);
}
 
Example 3
Source Project: j2objc   File: ConcurrentHashMap8Test.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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 4
Source Project: j2objc   File: ConcurrentHashMap8Test.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}