Skip to content

Commit 596f5e3

Browse files
Stream
1 parent 07962aa commit 596f5e3

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.java15.example.concurrency1;
2+
3+
import java.util.concurrent.ExecutionException;
4+
import java.util.concurrent.FutureTask;
5+
import java.util.function.UnaryOperator;
6+
import java.util.stream.Stream;
7+
8+
public class Application {
9+
public static void main(String[] args) throws ExecutionException, InterruptedException {
10+
/* FutureTask<String> futureTask = new FutureTask<>(new CallableImpl());
11+
Thread thread = new Thread(futureTask);
12+
thread.start();
13+
Thread.sleep(100);
14+
System.out.println(futureTask.get());*/
15+
streamDemo();
16+
}
17+
18+
19+
static public void streamDemo(){
20+
UnaryOperator<String> lowerCase = String::toLowerCase;
21+
//Stream.generate(()->"Hello World!").forEach(System.out::println);
22+
Stream.iterate("Hello World!",lowerCase).forEach(System.out::println);
23+
24+
}
25+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.java15.example.concurrency1;
2+
3+
import java.util.concurrent.Callable;
4+
5+
public class CallableImpl implements Callable<String> {
6+
@Override
7+
public String call() throws Exception {
8+
return "Hello World";
9+
}
10+
}

0 commit comments

Comments
 (0)