0

i was wondering if someone can give me some hints here. I am learning RxScala and i have the following exercise to do: - Implement an observable object that emits an event every 5 seconds and every 12 seconds

I was wondering if the following code does it ? havent managed to find lots of documentation for OBservable combinators

    val evens =  Observable.interval(5.second).filter(_ % 6 != 0)
    val odds = Observable.interval(12.second).filter(_ % 5 != 0)
    val merged = evens.merge(odds)
    merged.subscribe(it => println(it))

Thanks and regards Marco

user1068378
  • 333
  • 2
  • 12
  • I forgot to add the complete exercise. Implmeent an Observable which emits every 5 seconds and every 12 seconds, but not if the elapsed time is a multiple of 30 seconds. That's why i have the filters – user1068378 Oct 07 '15 at 21:15
  • I think that's right. You can find documents about operators here: http://reactivex.io/documentation/operators.html – zsxwing Oct 08 '15 at 16:17

0 Answers0