- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
LongStream parallel() method in Java
The parallel() method of the LongStream class in Java returns an equivalent stream that is parallel.
The syntax is as follows:
LongStream parallel()
To use the LongStream class in Java, import the following package
Example
import java.util.stream.LongStream;
The following is an example to implement LongStream parallel() method in Java:
import java.util.stream.LongStream; public class Demo { public static void main(String[] args) { LongStream longStream = LongStream.range(10L, 20L); System.out.println("Parallel LongStream = "); longStream.parallel().forEach(System.out::println); } }
output
Parallel LongStream = 16 15 10 17 11 13 12 19 18 14
Advertisements