--- jsr166/src/test/tck/ConcurrentHashMap8Test.java 2013/03/22 14:11:32 1.3 +++ jsr166/src/test/tck/ConcurrentHashMap8Test.java 2013/03/22 18:09:52 1.5 @@ -68,7 +68,7 @@ public class ConcurrentHashMap8Test exte map.computeIfAbsent(six, (x) -> null); assertFalse(map.containsKey(six)); } - + /** * computeIfPresent does not replace if the key is already present */ @@ -380,7 +380,7 @@ public class ConcurrentHashMap8Test exte elements[i] = i; Collections.shuffle(Arrays.asList(elements)); Collection full = populatedSet(elements); - + assertTrue(Arrays.asList(elements).containsAll(Arrays.asList(full.toArray()))); assertTrue(full.containsAll(Arrays.asList(full.toArray()))); assertSame(Object[].class, full.toArray().getClass()); @@ -442,7 +442,7 @@ public class ConcurrentHashMap8Test exte static final int SIZE = 10000; static ConcurrentHashMap longMap; - + static ConcurrentHashMap longMap() { if (longMap == null) { longMap = new ConcurrentHashMap(SIZE); @@ -456,7 +456,7 @@ public class ConcurrentHashMap8Test exte static class AddKeys implements BiFunction, Map.Entry, Map.Entry> { public Map.Entry apply(Map.Entry x, Map.Entry y) { return new AbstractMap.SimpleEntry - (Long.valueOf(x.getKey().longValue() + y.getKey().longValue()), + (Long.valueOf(x.getKey().longValue() + y.getKey().longValue()), Long.valueOf(1L)); } } @@ -726,7 +726,7 @@ public class ConcurrentHashMap8Test exte ConcurrentHashMap m = longMap(); Long r = m.reduceSequentially((Long x, Long y) -> Long.valueOf(x.longValue() + y.longValue()), (Long x, Long y) -> Long.valueOf(x.longValue() + y.longValue())); - + assertEquals((long)r, (long)3 * SIZE * (SIZE - 1) / 2); } @@ -777,7 +777,7 @@ public class ConcurrentHashMap8Test exte public void testReduceKeysToIntSequentially() { ConcurrentHashMap m = longMap(); int ir = m.reduceKeysToIntSequentially((Long x) -> x.intValue(), 0, Integer::sum); - assertEquals(ir, (int)SIZE * (SIZE - 1) / 2); + assertEquals(ir, SIZE * (SIZE - 1) / 2); } /* @@ -804,7 +804,7 @@ public class ConcurrentHashMap8Test exte public void testReduceValuesToIntSequentially() { ConcurrentHashMap m = longMap(); int ir = m.reduceValuesToIntSequentially((Long x) -> x.intValue(), 0, Integer::sum); - assertEquals(ir, (int)SIZE * (SIZE - 1)); + assertEquals(ir, SIZE * (SIZE - 1)); } /* @@ -831,7 +831,7 @@ public class ConcurrentHashMap8Test exte public void testReduceKeysToIntInParallel() { ConcurrentHashMap m = longMap(); int ir = m.reduceKeysToIntInParallel((Long x) -> x.intValue(), 0, Integer::sum); - assertEquals(ir, (int)SIZE * (SIZE - 1) / 2); + assertEquals(ir, SIZE * (SIZE - 1) / 2); } /* @@ -858,7 +858,7 @@ public class ConcurrentHashMap8Test exte public void testReduceValuesToIntInParallel() { ConcurrentHashMap m = longMap(); int ir = m.reduceValuesToIntInParallel((Long x) -> x.intValue(), 0, Integer::sum); - assertEquals(ir, (int)SIZE * (SIZE - 1)); + assertEquals(ir, SIZE * (SIZE - 1)); } /* @@ -877,9 +877,9 @@ public class ConcurrentHashMap8Test exte public void testSearchKeysSequentially() { ConcurrentHashMap m = longMap(); Long r; - r = m.searchKeysSequentially((Long x) -> x.longValue() == (long)(SIZE/2)? x : null); + r = m.searchKeysSequentially((Long x) -> x.longValue() == (long)(SIZE/2) ? x : null); assertEquals((long)r, (long)(SIZE/2)); - r = m.searchKeysSequentially((Long x) -> x.longValue() < 0L? x : null); + r = m.searchKeysSequentially((Long x) -> x.longValue() < 0L ? x : null); assertNull(r); } @@ -892,7 +892,7 @@ public class ConcurrentHashMap8Test exte Long r; r = m.searchValuesSequentially((Long x) -> x.longValue() == (long)(SIZE/2)? x : null); assertEquals((long)r, (long)(SIZE/2)); - r = m.searchValuesSequentially((Long x) -> x.longValue() < 0L? x : null); + r = m.searchValuesSequentially((Long x) -> x.longValue() < 0L ? x : null); assertNull(r); } @@ -903,9 +903,9 @@ public class ConcurrentHashMap8Test exte public void testSearchSequentially() { ConcurrentHashMap m = longMap(); Long r; - r = m.searchSequentially((Long x, Long y) -> x.longValue() == (long)(SIZE/2)? x : null); + r = m.searchSequentially((Long x, Long y) -> x.longValue() == (long)(SIZE/2) ? x : null); assertEquals((long)r, (long)(SIZE/2)); - r = m.searchSequentially((Long x, Long y) -> x.longValue() < 0L? x : null); + r = m.searchSequentially((Long x, Long y) -> x.longValue() < 0L ? x : null); assertNull(r); } @@ -916,9 +916,9 @@ public class ConcurrentHashMap8Test exte public void testSearchEntriesSequentially() { ConcurrentHashMap m = longMap(); Long r; - r = m.searchEntriesSequentially((Map.Entry e) -> e.getKey().longValue() == (long)(SIZE/2)? e.getKey() : null); + r = m.searchEntriesSequentially((Map.Entry e) -> e.getKey().longValue() == (long)(SIZE/2) ? e.getKey() : null); assertEquals((long)r, (long)(SIZE/2)); - r = m.searchEntriesSequentially((Map.Entry e) -> e.getKey().longValue() < 0L? e.getKey() : null); + r = m.searchEntriesSequentially((Map.Entry e) -> e.getKey().longValue() < 0L ? e.getKey() : null); assertNull(r); } @@ -929,9 +929,9 @@ public class ConcurrentHashMap8Test exte public void testSearchKeysInParallel() { ConcurrentHashMap m = longMap(); Long r; - r = m.searchKeysInParallel((Long x) -> x.longValue() == (long)(SIZE/2)? x : null); + r = m.searchKeysInParallel((Long x) -> x.longValue() == (long)(SIZE/2) ? x : null); assertEquals((long)r, (long)(SIZE/2)); - r = m.searchKeysInParallel((Long x) -> x.longValue() < 0L? x : null); + r = m.searchKeysInParallel((Long x) -> x.longValue() < 0L ? x : null); assertNull(r); } @@ -942,9 +942,9 @@ public class ConcurrentHashMap8Test exte public void testSearchValuesInParallel() { ConcurrentHashMap m = longMap(); Long r; - r = m.searchValuesInParallel((Long x) -> x.longValue() == (long)(SIZE/2)? x : null); + r = m.searchValuesInParallel((Long x) -> x.longValue() == (long)(SIZE/2) ? x : null); assertEquals((long)r, (long)(SIZE/2)); - r = m.searchValuesInParallel((Long x) -> x.longValue() < 0L? x : null); + r = m.searchValuesInParallel((Long x) -> x.longValue() < 0L ? x : null); assertNull(r); } @@ -955,9 +955,9 @@ public class ConcurrentHashMap8Test exte public void testSearchInParallel() { ConcurrentHashMap m = longMap(); Long r; - r = m.searchInParallel((Long x, Long y) -> x.longValue() == (long)(SIZE/2)? x : null); + r = m.searchInParallel((Long x, Long y) -> x.longValue() == (long)(SIZE/2) ? x : null); assertEquals((long)r, (long)(SIZE/2)); - r = m.searchInParallel((Long x, Long y) -> x.longValue() < 0L? x : null); + r = m.searchInParallel((Long x, Long y) -> x.longValue() < 0L ? x : null); assertNull(r); } @@ -968,9 +968,9 @@ public class ConcurrentHashMap8Test exte public void testSearchEntriesInParallel() { ConcurrentHashMap m = longMap(); Long r; - r = m.searchEntriesInParallel((Map.Entry e) -> e.getKey().longValue() == (long)(SIZE/2)? e.getKey() : null); + r = m.searchEntriesInParallel((Map.Entry e) -> e.getKey().longValue() == (long)(SIZE/2) ? e.getKey() : null); assertEquals((long)r, (long)(SIZE/2)); - r = m.searchEntriesInParallel((Map.Entry e) -> e.getKey().longValue() < 0L? e.getKey() : null); + r = m.searchEntriesInParallel((Map.Entry e) -> e.getKey().longValue() < 0L ? e.getKey() : null); assertNull(r); } @@ -994,7 +994,7 @@ public class ConcurrentHashMap8Test exte assertEquals(adder.sum(), 3 * SIZE * (SIZE - 1) / 2); adder.reset(); ConcurrentHashMap.ForkJoinTasks.forEachEntry - (m, + (m, (Map.Entry e) -> adder.add(e.getKey().longValue() + e.getValue().longValue())).invoke(); assertEquals(adder.sum(), 3 * SIZE * (SIZE - 1) / 2); adder.reset(); @@ -1043,7 +1043,7 @@ public class ConcurrentHashMap8Test exte assertEquals(lr, (long)SIZE * (SIZE - 1) / 2); ir = ConcurrentHashMap.ForkJoinTasks.reduceKeysToInt (m, (Long x) -> x.intValue(), 0, Integer::sum).invoke(); - assertEquals(ir, (int)SIZE * (SIZE - 1) / 2); + assertEquals(ir, SIZE * (SIZE - 1) / 2); dr = ConcurrentHashMap.ForkJoinTasks.reduceKeysToDouble (m, (Long x) -> x.doubleValue(), 0.0, Double::sum).invoke(); assertEquals(dr, (double)SIZE * (SIZE - 1) / 2); @@ -1056,7 +1056,7 @@ public class ConcurrentHashMap8Test exte assertEquals(lr, (long)SIZE * (SIZE - 1)); ir = ConcurrentHashMap.ForkJoinTasks.reduceValuesToInt (m, (Long x) -> x.intValue(), 0, Integer::sum).invoke(); - assertEquals(ir, (int)SIZE * (SIZE - 1)); + assertEquals(ir, SIZE * (SIZE - 1)); dr = ConcurrentHashMap.ForkJoinTasks.reduceValuesToDouble (m, (Long x) -> x.doubleValue(), 0.0, Double::sum).invoke(); assertEquals(dr, (double)SIZE * (SIZE - 1)); @@ -1072,5 +1072,5 @@ public class ConcurrentHashMap8Test exte r = ConcurrentHashMap.ForkJoinTasks.searchEntries (m, (Map.Entry e) -> e.getKey().longValue() == (long)(SIZE/2)? e.getKey() : null).invoke(); assertEquals((long)r, (long)(SIZE/2)); - } + } }