Skip to content
Related Articles

Related Articles

LongStream empty() in Java with examples
  • Last Updated : 06 Dec, 2018

LongStream empty() is a method in This method returns an empty sequential LongStream.
Syntax :

static LongStream empty() 

Parameters :

  1. 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.*;
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

Output :


Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :