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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。