forked from DreamCats/java-notes
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTest7.java
More file actions
25 lines (19 loc) · 668 Bytes
/
Test7.java
File metadata and controls
25 lines (19 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* @program JavaBooks
* @description: steam
* @author: mf
* @create: 2020/08/04 22:15
*/
package lmd;
import java.util.stream.Stream;
public class Test7 {
public static void main(String[] args) {
// forEach
Stream<String> stream = Stream.of("I", "love", "you", "too");
// stream.forEach(s -> System.out.println(s));
// stream.filter(s -> s.length() == 3).forEach(s -> System.out.println(s));
Stream<String> stream1 = Stream.of("I", "love", "you", "too", "too");
stream1.distinct().forEach(s -> System.out.println(s));
stream.map(s -> s.toUpperCase()).forEach(s -> System.out.println(s));
}
}