I repeatedly encounter the same problem when I have several asynchronous operations performed in a certain sequence, and in particular, are performed clearly sequentially, for example: we get the value from the database (realm), and after that we call another function, where we pass these values . Is there something like "promises" or "future (future)" in java? Not to create a new stream in which for with a lot of if-s will spin. If not, how can this be implemented.

  • 2
    There is such a thing. Try RxJava - Yuriy SPb
  • Use callbacks. In the previous operation call the next one. Called callback hell =) - eugeneek
  • There is such, only in JavaScript, but Java did not succeed in this matter, as I understood. There is a very powerful framework in the form of RxJava 2, but with all its capabilities, it does not know how, rx has many tools, but there are very few examples for them. One more similar Scheduler.Worker, but how to use it? - Valeriy

0