Java中的IntStream empty()方法
empty()IntStream类的方法返回空的顺序IntStream。
语法如下
static IntStream empty()
这是创建空IntStream的方法
IntStream intStream = IntStream.empty();
现在,使用该count()方法,您可以检查流中的元素计数,因为我们创建了空流,所以该计数为0
IntStream intStream = IntStream.empty();
以下是empty()在Java中实现IntStream方法的示例
示例
import java.util.stream.IntStream;
public class Demo {
public static void main(String[] args) {
IntStream intStream = IntStream.empty();
System.out.println("The number of elements in the stream = "+intStream.count());
}
}输出结果
The number of elements in the stream = 0
热门推荐
10 读书祝福语女生短句简短
11 感谢同事新婚祝福语简短
12 感谢教官文案祝福语简短
13 员工聚会蛋糕祝福语简短
14 元宵发客户祝福语简短
15 给团队信心祝福语简短
16 医美的祝福语大全简短
17 异国姻缘的祝福语简短
18 兄妹拍照祝福语简短的话