diff --git a/core-java/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java b/core-java/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java index 29c4ae53ce..e53a2413d1 100644 --- a/core-java/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java +++ b/core-java/src/main/java/com/baeldung/concurrent/future/SquareCalculator.java @@ -1,6 +1,5 @@ package com.baeldung.concurrent.future; -import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -13,12 +12,9 @@ public class SquareCalculator { } public Future calculate(Integer input) { - return executor.submit(new Callable() { - @Override - public Integer call() throws Exception { - Thread.sleep(1000); - return input * input; - } - }); + return executor.submit(() -> { + Thread.sleep(1000); + return input * input; + }); } }