IntStream empty() is a method in java.util.stream.IntStream. This method returns an empty sequential IntStream.
Syntax :
static <T> Stream<T> empty()
Where, T is the type of stream elements,
and the function returns an empty sequential stream.
Example 1 : Creating empty IntStream.
import java.util.*;
import java.util.stream.IntStream;
class GFG {
public static void main(String[] args) {
IntStream stream = IntStream.empty();
System.out.println(stream.count());
}
}
|
Output :
0
Example 2 : Creating empty LongStream.
import java.util.*;
import java.util.stream.LongStream;
class GFG {
public static void main(String[] args) {
LongStream stream = LongStream.empty();
System.out.println(stream.count());
}
}
|
Output :
0
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
06 Dec, 2018
Like Article
Save Article