63 |
|
*/ |
64 |
|
public void testComputeIfAbsent() { |
65 |
|
ConcurrentHashMap map = map5(); |
66 |
< |
map.computeIfAbsent(six, (x) -> "Z"); |
66 |
> |
map.computeIfAbsent(six, x -> "Z"); |
67 |
|
assertTrue(map.containsKey(six)); |
68 |
|
} |
69 |
|
|
72 |
|
*/ |
73 |
|
public void testComputeIfAbsent2() { |
74 |
|
ConcurrentHashMap map = map5(); |
75 |
< |
assertEquals("A", map.computeIfAbsent(one, (x) -> "Z")); |
75 |
> |
assertEquals("A", map.computeIfAbsent(one, x -> "Z")); |
76 |
|
} |
77 |
|
|
78 |
|
/** |
80 |
|
*/ |
81 |
|
public void testComputeIfAbsent3() { |
82 |
|
ConcurrentHashMap map = map5(); |
83 |
< |
map.computeIfAbsent(six, (x) -> null); |
83 |
> |
map.computeIfAbsent(six, x -> null); |
84 |
|
assertFalse(map.containsKey(six)); |
85 |
|
} |
86 |
|
|
1107 |
|
public void realRun() { |
1108 |
|
int result = 0; |
1109 |
|
for (int i = 0; i < iterations; i++) |
1110 |
< |
result += map.computeIfAbsent(i % mapSize, (k) -> k + k); |
1110 |
> |
result += map.computeIfAbsent(i % mapSize, k -> k + k); |
1111 |
|
if (result == -42) throw new Error(); |
1112 |
|
}}; |
1113 |
|
for (int i = 0; i < threads; i++) |