forked from bage2014/study
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.java
More file actions
41 lines (31 loc) · 1.02 KB
/
App.java
File metadata and controls
41 lines (31 loc) · 1.02 KB
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
31
32
33
34
35
36
37
38
39
40
41
package com.bage;
import rx.Observable;
import rx.Observer;
/**
* Hello world!
*/
public class App {
public static void main(String[] args) {
Observable<String> fWorld = new CommandHelloWorld("Bob").observe();
// - this is a verbose anonymous inner-class approach and doesn't do assertions
fWorld.subscribe(new Observer<String>() {
@Override
public void onCompleted() {
// nothing needed here
System.out.println("onCompleted: ");
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
}
@Override
public void onNext(String v) {
System.out.println("onNext: " + v);
}
});
// Future<String> s = new CommandHelloWorld("Bob").queue();
// Observable<String> s = new CommandHelloWorld("Bob").observe();
String s = new CommandHelloWorld("Bob").execute();
System.out.println(s);
}
}