- Trending Categories
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
IntStream sequential() method in Java
The sequential() method of the IntStream class in Java is used to return a sequential IntStream. The syntax is as follows:
IntStream sequential()
First, create an IntStream and elements in a range using the range() method:
IntStream intStream1 = IntStream.range(11, 21);
Now, for a sequential IntStream, use the sequential() method like this:
IntStream intStream2 = intStream1.sequential();
The following is an example to implement IntStream sequential() method in Java:
Example
import java.util.*; import java.util.stream.IntStream; public class Demo { public static void main(String[] args) { IntStream intStream1 = IntStream.range(11, 21); IntStream intStream2 = intStream1.sequential(); intStream2.forEach(System.out::println); } }
Output
11 12 13 14 15 16 17 18 19 20
Advertisements