- 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 empty() method in Java
The empty() method of the LongStream class in Java returns an empty sequential LongStream.
The syntax is as follows.
static LongStream empty()
To use the LongStream class in Java, import the following package.
import java.util.stream.LongStream;
The following is an example to implement LongStream empty() method in Java.
Example
import java.util.stream.LongStream; public class GFG { public static void main(String[] args) { LongStream longStream = LongStream.empty(); System.out.println("The count of elements in the stream: "+longStream.count()); } }
Output
The count of elements in the stream: 0
Advertisements