Riddling your way to master RxJava

In the beginning RxJava can look quite complex and perplex. The learning curve seems really high and almost impossible to anyone who’s not familiar with the reactive programming principle.

Let’s see how we can approach RxJava and make it easy to understand for everyone.

Step 1

Over the time I’ve found it is easiest to learn RxJava by examples and knowing which operators exist.

Step 2

Reading the tests of RxJava is quite a good exercise to get to know some of the operators and understand how they work. Every operator is thoroughly unit tested.

Step 3

Once you have a common understanding — the next level would be to look at the source code and see how operators are implemented. There are certain patterns how one would implement a operator and once you know them reading and even writing your own operators is “straight forward”.

In case you’re interested in this I have written a blog post about the takeUntil operator and go into great details how it works.


To help everyone with the first step I have composed a few riddles that can be solved to learn RxJava and it’s operators.


Each riddle is in a single file with an accompanied unit test that will check your implementation. Next to the unit test I have also put up my solution.

Note: that there are multiple ways to achieve and solve the riddles but usually there’s a dedicated operator or function that I want to show you.

Here is an example of the first riddle.

First riddle

And it’s accompanying unit test.

First riddle with a unit test


I hope you like the idea and give it a try.

I’m happy to receive any feedback and new riddles. For that please consult with the contributions section.