A powerful operation that you can achieve with RxJava is to group emissions by a specified key into separate Observables. This can be achieved by calling the groupBy() operator, which accepts a lambda mapping each emission to a key. It will then return an Observable<GroupedObservable<K,T>>, which emits a special type of Observable called GroupedObservable. GroupedObservable<K,T> is just like any other Observable, but it has the key K value accessible as a property. It will emit the T emissions that are mapped for that given key.
For instance, we can use the groupBy() operator to group emissions for an Observable<String> by each String's length. We will subscribe to it in a moment, but here is how we declare it:
import io.reactivex.Observable;
import io.reactivex.observables.GroupedObservable;
public class Launcher {
public static...