diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
new file mode 100644
index 00000000..ec167c15
--- /dev/null
+++ b/dependency-reduced-pom.xml
@@ -0,0 +1 @@
+
4.0.0
manning
lambdasinaction
1.0
maven-compiler-plugin
3.1
1.9
1.9
maven-shade-plugin
package
shade
benchmarks
org.openjdk.jmh.Main
UTF-8
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 10e5035e..8145f29b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,6 +28,27 @@
junit
4.11
+
+ org.projectlombok
+ lombok-utils
+ 1.18.6
+
+
+ org.projectlombok
+ lombok
+ 1.18.22
+ compile
+
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.17.1
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.17.1
+
diff --git a/src/main/java/lambdasinaction/chap11/LSep17.java b/src/main/java/lambdasinaction/chap11/LSep17.java
new file mode 100644
index 00000000..4cec31a4
--- /dev/null
+++ b/src/main/java/lambdasinaction/chap11/LSep17.java
@@ -0,0 +1,97 @@
+package lambdasinaction.chap11;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+/**
+ * https://www.youtube.com/watch?v=0hQvWIdwnw4&ab_channel=Devoxx
+ */
+public class LSep17 {
+
+ static void future() {
+
+ create().thenAccept(d -> System.out.println(d))
+ .thenRun(() -> System.out.println("this never dies"))
+ .thenRun(() -> System.out.println("really, this never dies"))
+ .thenRun(() -> System.out.println("r...really, this never dies"));
+ }
+
+
+ void randomTest() {
+ ExecutorService executorService =
+ new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
+
+ Runnable r = () -> {
+ try {
+ TimeUnit.MILLISECONDS.sleep(300);
+
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ };
+
+ Callable tasks = () -> {
+ TimeUnit.MILLISECONDS.sleep(300);
+ return "Task's execution";
+ };
+ }
+
+
+ static CompletableFuture create() {
+ return CompletableFuture.supplyAsync(() -> 2);
+ }
+
+ public static void main(String[] args) throws IOException {
+ LSep17 ls = new LSep17();
+
+ String dd = LocalDateTime.now().format(DateTimeFormatter.ofPattern("MMddHHmm"));
+ System.out.println(dd);
+
+// List lst = new ArrayList<>(Arrays.asList(""));
+// lst = IntStream.range(1, 10).mapToObj(i -> String.format("data %s", i)).collect(Collectors.toList());
+// ls.writeListString(lst);
+ System.out.println("done");
+
+ }
+ void method() {
+ String fileName = "this_is_large_file.txt";
+ IntStream.range(0, 5).map(x -> {
+ try {
+ whenWriteStringUsingBufferedWritter_thenCorrect(fileName);
+ } catch (IOException e) {
+ throw new RuntimeException(e); // TODO
+ }
+ return x;
+ }).forEach(System.out::println);
+
+ }
+
+ public void writeListString(List fileListing) throws IOException {
+ }
+
+ public void whenWriteStringUsingBufferedWritter_thenCorrect(String fileName)
+ throws IOException {
+ String str = LocalDateTime.now() + " Hello\n";
+ BufferedWriter writer = new BufferedWriter(new FileWriter(fileName, true));
+ writer.write(str);
+
+ writer.close();
+ }
+}
diff --git a/src/main/java/lambdasinaction/chap11/README.md b/src/main/java/lambdasinaction/chap11/README.md
new file mode 100644
index 00000000..e69de29b
diff --git a/src/main/java/lambdasinaction/chap11/v1/BestPriceFinderMain.java b/src/main/java/lambdasinaction/chap11/v1/BestPriceFinderMain.java
index 5a74161a..c1c66626 100644
--- a/src/main/java/lambdasinaction/chap11/v1/BestPriceFinderMain.java
+++ b/src/main/java/lambdasinaction/chap11/v1/BestPriceFinderMain.java
@@ -8,6 +8,7 @@ public class BestPriceFinderMain {
private static BestPriceFinder bestPriceFinder = new BestPriceFinder();
public static void main(String[] args) {
+ //turns the return res as Supplier
execute("sequential", () -> bestPriceFinder.findPricesSequential("myPhone27S"));
execute("parallel", () -> bestPriceFinder.findPricesParallel("myPhone27S"));
execute("composed CompletableFuture", () -> bestPriceFinder.findPricesFuture("myPhone27S"));
diff --git a/src/main/java/learning/AnyOfFutures.java b/src/main/java/learning/AnyOfFutures.java
new file mode 100644
index 00000000..50885b13
--- /dev/null
+++ b/src/main/java/learning/AnyOfFutures.java
@@ -0,0 +1,42 @@
+package learning;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+
+public class AnyOfFutures {
+
+ void anyOfTest() throws ExecutionException, InterruptedException {
+ CompletableFuture future1 = CompletableFuture.supplyAsync(() -> {
+ try {
+ TimeUnit.SECONDS.sleep(2);
+ } catch (InterruptedException e) {
+ throw new IllegalStateException(e);
+ }
+ return "Result of Future 1";
+ });
+
+ CompletableFuture future2 = CompletableFuture.supplyAsync(() -> {
+ try {
+ TimeUnit.SECONDS.sleep(1);
+ } catch (InterruptedException e) {
+ throw new IllegalStateException(e);
+ }
+ return "Result of Future 2";
+ });
+
+ CompletableFuture future3 = CompletableFuture.supplyAsync(() -> {
+ try {
+ TimeUnit.SECONDS.sleep(3);
+ } catch (InterruptedException e) {
+ throw new IllegalStateException(e);
+ }
+ return "Result of Future 3";
+ });
+
+ CompletableFuture