LongStream empty() is a method in java.util.stream.LongStream. This method returns an empty sequential LongStream.
Syntax :
static LongStream empty()
Parameters :
- LongStream : A sequence of primitive long-valued elements.
Return Value : An empty sequential LongStream.
Example 1 : Creating empty LongStream.
// Java code for LongStream empty() import java.util.*; import java.util.stream.LongStream; class GFG { // Driver code public static void main(String[] args) { // creating an empty LongStream, a sequence of // primitive long-valued elements LongStream stream = LongStream.empty(); // Displaying an empty sequential stream System.out.println(stream.count()); } } |
Output :
0