进阶day07-Stream流中的常用方法_count
This commit is contained in:
14
javaSE-day07/src/com/inmind/stream03/CountDemo20.java
Normal file
14
javaSE-day07/src/com/inmind/stream03/CountDemo20.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.inmind.stream03;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/*
|
||||
Stream流中的常用方法_count
|
||||
获取流中元素的个数
|
||||
*/
|
||||
public class CountDemo20 {
|
||||
public static void main(String[] args) {
|
||||
Stream<Integer> stream = Stream.of(1, 2, 4);
|
||||
System.out.println(stream.count());//3
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user