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