forked from algorithm024/algorithm024
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
22 lines (19 loc) · 804 Bytes
/
Test.java
File metadata and controls
22 lines (19 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.util.List;
import java.util.concurrent.*;
public class Test {
private static String extractHostName(String url) {
String host = url.substring(7);
return host.indexOf("/") == -1 ? host : host.substring(0, host.indexOf("/"));
}
public static void main(String[] args) throws ExecutionException, InterruptedException {
System.out.println(extractHostName("http://news.yahoo.com/news/topics/"));
ExecutorService executorService = Executors.newFixedThreadPool(1);
Future<List<String>> listFuture = executorService.submit(new Callable<List<String>>() {
@Override
public List<String> call() throws Exception {
return null;
}
});
List<String> strings = listFuture.get();
}
}