VOOZH about

URL: https://www.geeksforgeeks.org/java/parallel-data-processing-java-set-1/

⇱ Parallel Data Processing in Java | Set 1 - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Parallel Data Processing in Java | Set 1

Last Updated : 2 Nov, 2017
We know that new Stream in Java (introduced in Java 8) interface let us manipulate collections of data in a declarative way. In this topic, we will discover how the Stream interface gives us the opportunity to execute operations in parallel on a collection of data without much effort. It lets us declaratively turn a sequential stream into a parallel one Definition and Making into Parallel Streams: A parallel stream is one that splits the elements into multiple streams and assigns them into multiple chunks on different threads. Thus we can divide the workload of a given operation on the core of multiprocessors and thus it will make the CPU busy. We can convert the stream into parallel by attaching the keyword ‘parallel’. Following example just gives us the idea how we can convert a stream into a parallel one! Output :
Sum is 55
In the next part, we will see the difference between the performance of parallel streams, sequential streams and iterative process and taking a review on certain more specialized methods in parallel streams. Reference : https://docs.oracle.com/javase/tutorial/collections/streams/parallelism.html
Comment
Article Tags: