Like the Scala language, RxScala also has a map() function. In RxScala, Observable's map() function returns an Observable that applies the given function to each item emitted by an Observable and emits the result. It is defined as follows:
def map[R](func: T => R): Observable[R]
The following example demonstrates how Observable's map() function works:
RxScalaMapFunctionExample.scala:
import rx.lang.scala.Observable object RxScalaMapFunctionExample extends App { val observable = Observable.just(1) observable.map(x => x) }
RxScala's map() function Marble diagram is represented as follows:
RxScala's distinct() function ...