DoubleStream empty()是java.util.stream.DoubleStream中的方法。此方法返回空的顺序DoubleStream。
用法:
static DoubleStream empty() Where, DoubleStream is a sequence of primitive double-valued elements and the function returns an empty sequential stream.
示例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());
}
}
输出:
0
示例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()));
}
}
输出:
[]
相关用法
- Java DoubleStream min()用法及代码示例
- Java DoubleStream max()用法及代码示例
- Java DoubleStream count()用法及代码示例
- Java DoubleStream noneMatch()用法及代码示例
- Java DoubleStream average()用法及代码示例
- Java DoubleStream peek()用法及代码示例
- Java DoubleStream anyMatch()用法及代码示例
- Java DoubleStream allMatch()用法及代码示例
- Java DoubleStream filter()用法及代码示例
- Java DoubleStream distinct()用法及代码示例
- Java DoubleStream limit()用法及代码示例
- Java DoubleStream boxed()用法及代码示例
- Java DoubleStream builder()用法及代码示例
- Java DoubleStream.Builder add(double t)用法及代码示例
- Java DoubleStream reduce(double identity, DoubleBinaryOperator op)用法及代码示例
注:本文由纯净天空筛选整理自Sahil_Bansall大神的英文原创作品 DoubleStream empty() in Java with examples。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。