I would like to build a togglable iterable stream (Observable<List<T>>
) as follows:
Is this easy to achieve with RxJava?
Pardon if my question is not clear, I am new to reactive programming.
I think you can do it with a single Subject
+ scan
operator:
val subject = PublishSubject.create<Int>()
subject.scan(mutableListOf<Int>()) { list, item ->
list += item
list
}