February 2020
Intermediate to advanced
412 pages
9h 36m
English
For a given Observable<T>, the map() operator transforms an emitted value of the T type into a value of the R type (that may or may not be the same type T) using the Function<T,R> lambda expression provided. We have already used this operator many times, turning String objects into integers (their lengths), for example. This time, we will take raw date strings and use the map() operator to turn each of them into a LocalDate emission, as shown in the following code snippet:
import io.reactivex.rxjava3.core.Observable;import java.time.LocalDate;import java.time.format.DateTimeFormatter;public class Ch3_14 { public static void main(String[] args) { DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy"); Observable.just("1/3/2016" ...
Read now
Unlock full access