-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStreamsOutPut.java
More file actions
30 lines (22 loc) · 877 Bytes
/
Copy pathStreamsOutPut.java
File metadata and controls
30 lines (22 loc) · 877 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
26
27
28
29
30
package streamInterviewQA;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.stream.Stream;
public class StreamsOutPut {
public static void main(String[] args) {
streamBasicOperation();
Consumer<String> strC = s -> System.out.println(s);
}
private static void streamBasicOperation() {
Stream<String> stream = Stream.of("123", "234", "345");
BiFunction<String, String, String> fun = (String s1, String s2) -> "Hello";
Stream<String> strm = stream.map((String s) -> s.substring(0, 1));
strm.forEach(System.out::print);
}
private static void streamBasicOperation2() {
Stream<String> stream = Stream.of("123", "234", "345");
BiFunction<String, String, String> fun = (String s1, String s2) -> "Hello";
Stream<String> strm = stream.map((String s) -> s.substring(0, 1));
strm.forEach(System.out::print);
}
}