You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,8 @@ public class HelloWorld {
56
56
If your platform doesn't support Java 8 lambdas (yet), you have to create an inner class of `Consumer` manually:
57
57
58
58
```java
59
+
importio.reactivex.functions.Consumer;
60
+
59
61
Flowable.just("Hello world")
60
62
.subscribe(newConsumer<String>() {
61
63
@Overridepublicvoidaccept(Strings) {
@@ -75,6 +77,8 @@ RxJava 2 features several base classes you can discover operators on:
75
77
One of the common use cases forRxJava is to run some computation, network request on a background thread and show the results (or error) on the UI thread:
Typically, you can move computations or blocking IO to some other thread via `subscribeOn`. Once the data is ready, you can make sure they get processed on the foreground or GUI thread via `observeOn`.
107
111
108
-
RxJava operators don't work `Thread`s or `ExecutorService`s directly but with so called `Scheduler`s that abstract away sources of concurrency behind an uniform API. RxJava 2 features several standard schedulers accessible via `Schedulers` utility class. These are available on all JVM platforms but some specific platforms, such as Android, have their own typical `Scheduler`s defined: `AndroidSchedulers.mainThread()`, `SwingScheduler.instance()` or `JavaFXSchedulers.gui()`.
112
+
RxJava operators don't work with `Thread`s or `ExecutorService`s directly but with so called `Scheduler`s that abstract away sources of concurrency behind an uniform API. RxJava 2 features several standard schedulers accessible via `Schedulers` utility class. These are available on all JVM platforms but some specific platforms, such as Android, have their own typical `Scheduler`s defined: `AndroidSchedulers.mainThread()`, `SwingScheduler.instance()` or `JavaFXSchedulers.gui()`.
109
113
110
114
The `Thread.sleep(2000);` at the end is no accident. InRxJava the default `Scheduler`s run on daemon threads, which means once the Java main thread exits, they all get stopped and background computations may never happen. Sleepingfor some time in this example situations let's you see the output of the flow on the console with time to spare.
0 commit comments