s-day07- Stream流中的常用方法_skip
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.inmind.stream07;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/*
|
||||
Stream流中的常用方法_skip
|
||||
Stream<T> skip(long n)
|
||||
跳过指定流的前几个元素,将剩下的元素组成新的流
|
||||
*/
|
||||
public class SkipDemo18 {
|
||||
public static void main(String[] args) {
|
||||
Stream<Integer> stream = Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
||||
stream.skip(5).forEach(i-> System.out.println(i));
|
||||
// System.out.println(stream.count());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user