Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update outdated java example in wiki #6331 #6351

Merged
merged 3 commits into from
Dec 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 14 additions & 9 deletions docs/How-To-Use-RxJava.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@ You can find additional code examples in the `/src/examples` folders of each [la
### Java

```java
public static void hello(String... names) {
Observable.from(names).subscribe(new Action1<String>() {

@Override
public void call(String s) {
System.out.println("Hello " + s + "!");
}
public static void hello(String... args) {
Flowable.fromArray(args).subscribe(s -> System.out.println("Hello " + s + "!"));
}
```

});
If your platform doesn't support Java 8 lambdas (yet), you have to create an inner class of ```Consumer``` manually:
```java
public static void hello(String... args) {
Flowable.fromArray(args).subscribe(new Consumer<String>() {
@Override
public void accept(String s) {
System.out.println("Hello " + s + "!");
}
});
}
```

Expand Down Expand Up @@ -397,4 +402,4 @@ myModifiedObservable = myObservable.onErrorResumeNext({ t ->
Throwable myThrowable = myCustomizedThrowableCreator(t);
return (Observable.error(myThrowable));
});
```
```