diff --git a/core-java-modules/core-java-streams-3/pom.xml b/core-java-modules/core-java-streams-3/pom.xml
index 6597c999d8..2ec2fa7c48 100644
--- a/core-java-modules/core-java-streams-3/pom.xml
+++ b/core-java-modules/core-java-streams-3/pom.xml
@@ -47,6 +47,7 @@
+ 1.18.20
3.6.1
diff --git a/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/ParallelStream.java b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/ParallelStream.java
new file mode 100644
index 0000000000..deeaf9ed59
--- /dev/null
+++ b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/ParallelStream.java
@@ -0,0 +1,14 @@
+package com.baeldung.streams.parallel;
+
+import java.util.List;
+
+public class ParallelStream {
+
+ public static void main(String[] args) {
+ List listOfNumbers = List.of(1, 2, 3, 4);
+ listOfNumbers.parallelStream().forEach(number ->
+ System.out.println(number + " " + Thread.currentThread().getName())
+ );
+ }
+
+}
diff --git a/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/SequentialStream.java b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/SequentialStream.java
new file mode 100644
index 0000000000..0e9c42640b
--- /dev/null
+++ b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/SequentialStream.java
@@ -0,0 +1,14 @@
+package com.baeldung.streams.parallel;
+
+import java.util.List;
+
+public class SequentialStream {
+
+ public static void main(String[] args) {
+ List listOfNumbers = List.of(1, 2, 3, 4);
+ listOfNumbers.stream().forEach(number ->
+ System.out.println(number + " " + Thread.currentThread().getName())
+ );
+ }
+
+}
diff --git a/core-java-modules/core-java-streams-3/src/test/java/com/baeldung/streams/parallel/ForkJoinUnitTest.java b/core-java-modules/core-java-streams-3/src/test/java/com/baeldung/streams/parallel/ForkJoinUnitTest.java
new file mode 100644
index 0000000000..12cf5ceb16
--- /dev/null
+++ b/core-java-modules/core-java-streams-3/src/test/java/com/baeldung/streams/parallel/ForkJoinUnitTest.java
@@ -0,0 +1,45 @@
+package com.baeldung.streams.parallel;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ForkJoinPool;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class ForkJoinUnitTest {
+
+ @Test
+ void givenSequentialStreamOfNumbers_whenReducingSumWithIdentityFive_thenResultIsCorrect() {
+ List listOfNumbers = List.of(1, 2, 3, 4);
+ int sum = listOfNumbers.stream().reduce(5, Integer::sum);
+ assertThat(sum).isEqualTo(15);
+ }
+
+ @Test
+ void givenParallelStreamOfNumbers_whenReducingSumWithIdentityFive_thenResultIsNotCorrect() {
+ List listOfNumbers = List.of(1, 2, 3, 4);
+ int sum = listOfNumbers.parallelStream().reduce(5, Integer::sum);
+ assertThat(sum).isNotEqualTo(15);
+ }
+
+ @Test
+ void givenParallelStreamOfNumbers_whenReducingSumWithIdentityZero_thenResultIsCorrect() {
+ List listOfNumbers = List.of(1, 2, 3, 4);
+ int sum = listOfNumbers.parallelStream().reduce(0, Integer::sum) + 5;
+ assertThat(sum).isEqualTo(15);
+ }
+
+ @Test
+ public void givenParallelStreamOfNumbers_whenUsingCustomThreadPool_thenResultIsCorrect()
+ throws InterruptedException, ExecutionException {
+ List listOfNumbers = List.of(1, 2, 3, 4);
+ ForkJoinPool customThreadPool = new ForkJoinPool(4);
+ int sum = customThreadPool.submit(
+ () -> listOfNumbers.parallelStream().reduce(0, Integer::sum)).get();
+ customThreadPool.shutdown();
+ assertThat(sum).isEqualTo(10);
+ }
+
+}