DoubleStream empty() in Java with examples
DoubleStream empty() is a method in java.util.stream.DoubleStream. This method returns an empty sequential DoubleStream.
Syntax :
static DoubleStream empty() Where, DoubleStream is a sequence of primitive double-valued elements and the function returns an empty sequential stream.
Example 1 :
// Java code for DoubleStream empty() import java.util.*; import java.util.stream.DoubleStream; class GFG { // Driver code public static void main(String[] args) { // creating an empty DoubleStream, a sequence of // primitive double-valued elements DoubleStream stream = DoubleStream.empty(); // Displaying an empty sequential stream System.out.println(stream.count()); } } |
chevron_right
filter_none
Output:
0
Example 2 :
// Java code for DoubleStream empty() import java.util.*; import java.util.stream.DoubleStream; class GFG { // Driver code public static void main(String[] args) { // creating an empty DoubleStream, a sequence of // primitive double-valued elements DoubleStream stream = DoubleStream.empty(); // Displaying an empty sequential stream System.out.println(Arrays.toString(stream.toArray())); } } |
chevron_right
filter_none
Output:
[]
Recommended Posts:
- DoubleStream max() in Java with examples
- DoubleStream min() in Java with examples
- DoubleStream builder() in Java with Examples
- DoubleStream anyMatch() in Java with examples
- DoubleStream filter() in Java with examples
- DoubleStream average() in Java with Examples
- DoubleStream count() in Java with examples
- DoubleStream noneMatch() in Java with examples
- DoubleStream peek() in Java with examples
- DoubleStream allMatch() in Java with examples
- DoubleStream distinct() in Java with examples
- DoubleStream boxed() in Java with Examples
- DoubleStream limit() in Java with Examples
- DoubleStream.Builder add(double t) in Java with Examples
- DoubleStream reduce(double identity, DoubleBinaryOperator op) in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

