Lets say I have two observable streams
Observable<Book> books;
Observable<Movie> movies;
How can I join these on when they have an attribute that matches? Something like the psudo code below:
Observable<BookMoviePair> pairs = books.join(movies)
.where((book, movie) -> book.getId() == movie.getId()))
.return((book, movie) -> new BookMoviePair(book, movie));
One way of doing it:
Observable<BookMoviePair> pairs =
books.flatMap(book -> movies
.first(movie -> movie.getId() == book.getId())
.map(movie -> new BookMoviePair(book, movie)));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With