Constructs a sequence from a pre-existing source or generator type.
Signals the items from ajava.lang.Iterable
source (such asLists
,Sets
orCollections
or customIterable
s) and then completes the sequence.
List<String> list = new ArrayList<>(); list.add("1"); list.add("2"); list.add("3"); Observable<String> observable = Observable.fromIterable(list); observable.subscribe(s -> { System.out.println(s); });
References
https://github.com/ReactiveX/RxJava/wiki/Creating-Observables#fromiterable