Reputation: 361
So I am hopping a project that uses RxJava A LOT. There split into modules, so it's like different entities inside the project. I'm looking to build a new module and I want to base it on Kotlin Coroutines. I feel like it shouldn't be an issue, but I'm asking anyways. Can you still use Both Kotlin Coroutines and RxJava under the same project? Thanks.
Upvotes: 0
Views: 1010
Reputation: 10699
Short answer: Yes, you can.
If you're thinking of using Rx Java for mere treading then stop, and go with coroutines. If you want to use Rx Java for things such as event bus, object manipulation (Filter, Map etc etc), message passing and stuff (That RX java is generally made for) then go for it. Using Rx Java just for multithreading is an overkill.
Upvotes: 1
Reputation: 93542
A closer comparison to RxJava would be a library like Flow. Generally you want to use one or the other, there's only two reasons why you'd want to use both:
But yes you can use them together, and bridging from one to the other isn't difficult.
Upvotes: 2