File tree 1 file changed +14
-9
lines changed
1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,20 @@ You can find additional code examples in the `/src/examples` folders of each [la
11
11
### Java
12
12
13
13
``` java
14
- public static void hello(String . .. names) {
15
- Observable . from(names). subscribe(new Action1<String > () {
16
-
17
- @Override
18
- public void call (String s ) {
19
- System . out. println(" Hello " + s + " !" );
20
- }
14
+ public static void hello(String . .. args) {
15
+ Flowable . fromArray(args). subscribe(s - > System . out. println(" Hello " + s + " !" ));
16
+ }
17
+ ```
21
18
22
- });
19
+ If your platform doesn't support Java 8 lambdas (yet), you have to create an inner class of ``` Consumer ``` manually:
20
+ ``` java
21
+ public static void hello(String . .. args) {
22
+ Flowable . fromArray(args). subscribe(new Consumer<String > () {
23
+ @Override
24
+ public void accept (String s ) {
25
+ System . out. println(" Hello " + s + " !" );
26
+ }
27
+ });
23
28
}
24
29
```
25
30
@@ -397,4 +402,4 @@ myModifiedObservable = myObservable.onErrorResumeNext({ t ->
397
402
Throwable myThrowable = myCustomizedThrowableCreator(t );
398
403
return (Observable.error(myThrowable ));
399
404
});
400
- ```
405
+ ```
You can’t perform that action at this time.
0 commit comments