--- jsr166/src/test/tck/ConcurrentHashMap8Test.java 2016/10/15 18:51:12 1.32 +++ jsr166/src/test/tck/ConcurrentHashMap8Test.java 2017/08/04 03:30:21 1.35 @@ -63,7 +63,7 @@ public class ConcurrentHashMap8Test exte */ public void testComputeIfAbsent() { ConcurrentHashMap map = map5(); - map.computeIfAbsent(six, (x) -> "Z"); + map.computeIfAbsent(six, x -> "Z"); assertTrue(map.containsKey(six)); } @@ -72,7 +72,7 @@ public class ConcurrentHashMap8Test exte */ public void testComputeIfAbsent2() { ConcurrentHashMap map = map5(); - assertEquals("A", map.computeIfAbsent(one, (x) -> "Z")); + assertEquals("A", map.computeIfAbsent(one, x -> "Z")); } /** @@ -80,7 +80,7 @@ public class ConcurrentHashMap8Test exte */ public void testComputeIfAbsent3() { ConcurrentHashMap map = map5(); - map.computeIfAbsent(six, (x) -> null); + map.computeIfAbsent(six, x -> null); assertFalse(map.containsKey(six)); } @@ -210,8 +210,8 @@ public class ConcurrentHashMap8Test exte Set set1 = map.keySet(); Set set2 = map.keySet(true); set2.add(six); - assertTrue(((ConcurrentHashMap.KeySetView)set2).getMap() == map); - assertTrue(((ConcurrentHashMap.KeySetView)set1).getMap() == map); + assertSame(map, ((ConcurrentHashMap.KeySetView)set2).getMap()); + assertSame(map, ((ConcurrentHashMap.KeySetView)set1).getMap()); assertEquals(set2.size(), map.size()); assertEquals(set1.size(), map.size()); assertTrue((Boolean)map.get(six)); @@ -305,10 +305,10 @@ public class ConcurrentHashMap8Test exte assertFalse(set.add(one)); assertTrue(set.add(six)); assertTrue(set.add(seven)); - assertTrue(set.getMappedValue() == one); - assertTrue(map.get(one) != one); - assertTrue(map.get(six) == one); - assertTrue(map.get(seven) == one); + assertSame(one, set.getMappedValue()); + assertNotSame(one, map.get(one)); + assertSame(one, map.get(six)); + assertSame(one, map.get(seven)); } void checkSpliteratorCharacteristics(Spliterator sp, @@ -543,7 +543,7 @@ public class ConcurrentHashMap8Test exte } /** - * A deserialized serialized set is equal + * A deserialized/reserialized set equals original */ public void testSerialization() throws Exception { int size = 20; @@ -1107,7 +1107,7 @@ public class ConcurrentHashMap8Test exte public void realRun() { int result = 0; for (int i = 0; i < iterations; i++) - result += map.computeIfAbsent(i % mapSize, (k) -> k + k); + result += map.computeIfAbsent(i % mapSize, k -> k + k); if (result == -42) throw new Error(); }}; for (int i = 0; i < threads; i++)