search

Home  >  Q&A  >  body text

Are there operators in RxJava that perform different functions based on conditions?

Rxjava newbie, I searched and found no relevant operators (I just didn’t find them)

I want to judge the obtained data in onNext.
Refresh different interfaces according to the type carried by the activity to the data. The current method is to onNextswitch + case The code is ugly.
I would like to ask if there is such an operator? (I thought about it and it seems that I can actively throw an exception, but this is not good)

PHPzPHPz2773 days ago848

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-05-16 13:36:43

    No, such logic needs to be written by yourself. You can extract the processing of different types into a separate method, which is easy to call and very concise.

    reply
    0
  • Cancelreply