Reactive Programming Made Simple Part 2

Reactive Programming Made Simple Part 2

The map Operator:

Observable<String> observable = Observable
.just(4, 3, 5)
.map(x -> 2 * 5);

The filter operator:

Observable<String> observable = Observable
.just(4, 3, 5)
.map(x -> 2 * x)
.filter(x -> x > 8);

Putting It to Use in Real Life:

Observable<Integer> friendNetworkRequest = getNumberOfFriends(“user1”)
friendNetworkRequest
.filter(friendCount -> friendCount > 100)
.subscribe(friendCount -> displayCountToScreen(friendCount))

I’m a self taught Android, iOS and VR developer fascinated with the world of mobile. I’m passionate about learning new technologies by way of teaching others.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store