From 044990ab6c2a963ff1aeed8cad32dd0784fcddcb Mon Sep 17 00:00:00 2001 From: Arkadiusz Hypki Date: Mon, 20 May 2024 17:49:51 +0200 Subject: [PATCH] 'Fixed formatting;' --- .../net/hypki/wmi/javafp/FunctionChaining.java | 2 +- .../src/net/hypki/wmi/javafp/Parallel.java | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/09_JavaFP/src/net/hypki/wmi/javafp/FunctionChaining.java b/09_JavaFP/src/net/hypki/wmi/javafp/FunctionChaining.java index 52320e9..ee51b6b 100644 --- a/09_JavaFP/src/net/hypki/wmi/javafp/FunctionChaining.java +++ b/09_JavaFP/src/net/hypki/wmi/javafp/FunctionChaining.java @@ -27,7 +27,7 @@ public class FunctionChaining { multiply .andThen(add) .andThen(logOutput) - .apply(input); + .apply(input); } public static void main(String[] args) { diff --git a/09_JavaFP/src/net/hypki/wmi/javafp/Parallel.java b/09_JavaFP/src/net/hypki/wmi/javafp/Parallel.java index ec5ff7f..31de7d0 100644 --- a/09_JavaFP/src/net/hypki/wmi/javafp/Parallel.java +++ b/09_JavaFP/src/net/hypki/wmi/javafp/Parallel.java @@ -18,7 +18,8 @@ public class Parallel { // map System.out.println("Computing squares (with limit and sort): "); List numbers = Arrays.asList(2,3,4,5); - numbers.stream() + numbers + .stream() .map(x -> x *x) // Function .sorted() .limit(2) @@ -33,15 +34,16 @@ public class Parallel { .stream() .filter(s -> s.startsWith("S")) // Predicate .collect(Collectors.toList()) - .forEach(System.out::println);; + .forEach(System.out::println); // print output -> [Sally, Sephora] // sorted System.out.println("Sorting names: "); - names.stream() + names + .stream() .sorted() .collect(Collectors.toList()) - .forEach(System.out::println);; + .forEach(System.out::println); // print output -> [Harry, Sally, Sephora] // reduce @@ -79,16 +81,17 @@ public class Parallel { .stream() .skip(1) .collect(Collectors.toList()) - .forEach(System.out::println);; + .forEach(System.out::println); // print output -> [3,4,5] System.out.println("Computing squares in parallel: "); - numbers.stream() + numbers + .stream() .parallel() // add this line here .map(x -> x *x) .sorted() .limit(2) .collect(Collectors.toList()) - .forEach(System.out::println);; + .forEach(System.out::println); } }