https://kotlinlang.org logo
#rx
Title
m

mingkangpan

04/12/2017, 9:51 PM
oaky, I got the issue, since rxbinding never calls onComplete,
groupby
can never work, fortunately I herad this in some presentation that groupby require onComple to get called by previous observables, but where is this documented?
t

thomasnield

04/12/2017, 10:10 PM
mingkangpan: if its infinite you might want to consider using scan() instead of reduce(). It will emit each rolling accumulation and does not require onComplete()
m

mingkangpan

04/12/2017, 10:22 PM
I wanted to try out the reduce since I want to get the sum of the 2 groups
p

Paul Woitaschek

04/13/2017, 4:36 AM
It does not need to be explicitly documented as its clear when you get a deeper understanding of rxjava
Just like toList. If it is not completed how can it tell when to emit?
But you can do the grouping before the first flatMap returns
Copy code
button.clicks()
  .flatMap {
 Observable.from(arrayListOf(1,2,3)).groupBy { … }...
  }
}