February 2019
Intermediate to advanced
442 pages
11h 46m
English
Observable provides support to emit the data from any iterable sources, for example, lists, maps, sets, and so on. It will call onNext() on each item of an iterable type, and once the iterator is over, it will call onComplete() automatically. Iterable in Java is commonly used in collection frameworks, so Observable with iterable can be used while fetching data from collection classes.
Let's see how to use it as follows:
public class RxJavaIterableDemo { public static void main(String[] args) { List<EmployeeRating> employeeList = new ArrayList<EmployeeRating>(); EmployeeRating employeeRating1 = new EmployeeRating(); employeeRating1.setName("Lilly"); employeeRating1.setRating(6); employeeList.add(employeeRating1);