Search code examples
androidrx-javaobservablerx-androidaccumulate

How can I accumulate each 2 emitted values of Observable with Rx on Android?


I have one observable that emits values from 0 to 10 for each second. I need to accumulate each two values and print a result of accumulator value with completion.


Solution

  • Done! I've used buffer(4) method to get each of 4 values in the list and save first two values from it to accumulate my counter :)