Hands-On Reactive Programming in Spring 5
上QQ阅读APP看书,第一时间看更新

Rebuilding our application with RxJava

To get a feel for RxJava, let's rewrite the previously written temperature sensing application with RxJava. To use the library in the application, let's add the following dependency to the build.gradle file:

compile('io.reactivex:rxjava:1.3.8')

Here, we are using the same value class to represent the current temperature, as shown in the following code:

final class Temperature {
private final double value;
// constructor & getter
}