

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 of() method in Java
The LongStream class in Java the following two forms of the of() method.
The following of() method returns a sequential LongStream containing a single element. Here is the syntax
static LongStream of(long t)
Here, parameter t is the single element.
The following of() method returns a sequential ordered stream whose elements are the specified values.
static LongStream of(long… values)
Here, the parameter values are the elements of the new stream.
To use the LongStream class in Java, import the following package.
import java.util.stream.LongStream;
The following is an example to implement LongStream of() method in Java.
Example
import java.util.stream.LongStream; public class Demo { public static void main(String[] args) { LongStream longStream = LongStream.of(20000L, 35000L, 40000L, 55000L); longStream.forEach(System.out::println); } }
Output
20000 35000 40000 55000
- Related Questions & Answers
- LongStream noneMatch() method in Java
- LongStream filter() method in Java
- LongStream forEach() method in Java
- LongStream max() method in Java
- LongStream rangeClosed() method in Java
- LongStream peek() method in Java
- LongStream empty() method in Java
- LongStream findFirst() method in Java
- LongStream anyMatch() method in Java
- LongStream toArray() method in Java
- LongStream summaryStatistics() method in Java
- LongStream boxed() method in Java
- LongStream sorted() method in Java
- LongStream asDoubleStream() method in Java
- LongStream skip() method in Java
Advertisements