Sometimes, it is necessary to have an object that can subscribe to an Observable while being able to act as an Observable at the same time. It is useful to have a way to glue different Observables in an independent manner.
A Subject is a way to do this in RxJava and, in this chapter, we will explore various types of Subjects and on what occasions they should be used.
In RxJava, there are four different classes of Subject:
Each of them has different use cases, and we will cover their unique aspects so that the developer will be able to make the correct choice.
Furthermore, in this chapter, we will see how we can use Subject for preferences ...