The Observable.combineLatest() factory is somewhat similar to zip(), but for every emission that fires from one of the sources, it will immediately couple up with the latest emission from every other source. It will not queue up unpaired emissions for each source, but rather cache and pair the latest one.
Here, let's use Observable.combineLatest() between two interval observables, the first emitting at 300 milliseconds and the other every second:
import io.reactivex.rxjava3.core.Observable;
import java.util.concurrent.TimeUnit;
public class Ch4_15 {
public static void main(String[] args) {
Observable<Long> source1 =
Observable.interval(300, TimeUnit.MILLISECONDS);
Observable<Long> source2 =
Observable.interval(1, TimeUnit.SECONDS);
Observable.combineLatest(source1...