From 8f7559df5e861e2cb0ee2139718a59e534abf0d5 Mon Sep 17 00:00:00 2001 From: Felipe Reis Date: Mon, 30 Jan 2017 15:14:50 -0200 Subject: [PATCH] BAEL-612: used lambda instead of anonymous class --- .../baeldung/concurrent/future/SquareCalculator.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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; + }); } }