Skip to content

Commit 8f7559d

Browse files
committed
BAEL-612: used lambda instead of anonymous class
1 parent f970b1d commit 8f7559d

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.baeldung.concurrent.future;
22

3-
import java.util.concurrent.Callable;
43
import java.util.concurrent.ExecutorService;
54
import java.util.concurrent.Future;
65

@@ -13,12 +12,9 @@ public SquareCalculator(ExecutorService executor) {
1312
}
1413

1514
public Future<Integer> calculate(Integer input) {
16-
return executor.submit(new Callable<Integer>() {
17-
@Override
18-
public Integer call() throws Exception {
19-
Thread.sleep(1000);
20-
return input * input;
21-
}
22-
});
15+
return executor.submit(() -> {
16+
Thread.sleep(1000);
17+
return input * input;
18+
});
2319
}
2420
}

0 commit comments

Comments
 (0)