We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c80d39b commit 4fa2b2bCopy full SHA for 4fa2b2b
src/com/winterbe/java8/samples/concurrent/Atomic1.java
@@ -3,7 +3,6 @@
3
import java.util.concurrent.ExecutorService;
4
import java.util.concurrent.Executors;
5
import java.util.concurrent.atomic.AtomicInteger;
6
-import java.util.function.IntBinaryOperator;
7
import java.util.stream.IntStream;
8
9
/**
@@ -45,10 +44,8 @@ private static void testAccumulate() {
45
44
46
IntStream.range(0, NUM_INCREMENTS)
47
.forEach(i -> {
48
- Runnable task = () -> {
49
- IntBinaryOperator operator = (a, b) -> a + b;
50
- atomicInt.accumulateAndGet(i, operator);
51
- };
+ Runnable task = () ->
+ atomicInt.accumulateAndGet(i, (n, m) -> n + m);
52
executor.submit(task);
53
});
54
0 commit comments