--- jsr166/src/test/tck/ConcurrentHashMapTest.java 2015/07/27 03:12:26 1.47 +++ jsr166/src/test/tck/ConcurrentHashMapTest.java 2016/07/17 03:40:07 1.48 @@ -803,4 +803,20 @@ public class ConcurrentHashMapTest exten } } + /** + * Tests performance of removeAll when the other collection is much smaller. + * ant -Djsr166.tckTestClass=ConcurrentHashMapTest -Djsr166.methodFilter=testRemoveAll_performance -Djsr166.expensiveTests=true tck + */ + public void testRemoveAll_performance() { + int mapSize = expensiveTests ? 1_000_000 : 100; + int iterations = expensiveTests ? 500 : 2; + ConcurrentHashMap map = new ConcurrentHashMap<>(); + for (int i = 0; i < mapSize; i++) + map.put(i, i); + Set keySet = map.keySet(); + Collection removeMe = Arrays.asList(new Integer[] { -99, -86 }); + for (int i = 0; i < iterations; i++) + assertFalse(keySet.removeAll(removeMe)); + assertEquals(mapSize, map.size()); + } }