The new Completable API (part 2 - final)
IntroductionIn this final part, I'm going to show how one can implement operators (source and transformative alike). Since the Completable API features no values but only the terminal onError and...
View ArticleFlatMap (part 1)
IntroductionIn this blog post, I begin to explain the outer and inner properties of the most used, misunderstood and at the same time, one of the most complex operator there is: flatMap.FlatMap is most...
View ArticleFlatMap (part 2)
IntroductionIn this post, we will look into expanding the features of our flatMap implementation and improve its performance.RxJava's flatMap implementation offers limiting the maximum concurrency,...
View ArticleRxJava design retrospect
IntoductionRxJava is now out more than 3 years and lived through several significant version changes. In this blog post, I'll point out design and implementation decisions that I personally think...
View ArticleOperator-fusion (Part 1)
IntroductionOperator-fusion, one of the cutting-edge research topics in the reactive programming world, is the aim to have two of more subsequent operators combined in a way that reduces overhead...
View ArticleWriting a custom reactive base type
IntroductionFrom time to time, the question or request comes up that one would really like to have his/her own reactive type. Even though RxJava's Observable has plenty of methods and extension points...
View ArticleSubscribeOn and ObserveOn
IntroductionOne of the most confused operator pair of the reactive ecosystem is the subscribeOn and observeOn operators. The source of confusion may be rooted in a few causes:they sound alike,they...
View ArticleOperator fusion (part 2 - final)
IntroductionIn the previous part, I've introduced the concepts around operator fusion. In this post, I'll detail the API and protocols required make operator fusion happen.In its current form, operator...
View ArticleGoogle Agera vs. ReactiveX
IntroductionIf you are following events around Android development, or just happen to follow all things reactive, there was a "big" announcement from Google: they've released their reactive programming...
View ArticleAsync Iterable/Enumerable vs. Reactive-Streams
IntroductionBackpressure is essential if one wants to avoid buffer bloat and excessive memory usage if two stages in a reactive pipeline consume events with different speed. RxJava and Reactive-Streams...
View ArticleThe Reactive Scrabble benchmarks
IntroductionIn the past year, I've been posting benchmark results under the mysterious Shakespeare Plays (Reactive) Scrabble name. In this blog post, I'll explain what this benchmark is, where does it...
View ArticleJava 9 Flow API: asynchronous integer range source
IntroductionJava 9 is becoming more reactive by introducing the Reactive-Streams interfaces under the parent class java.util.concurrent.Flow, enabling a new standard interoperation between future...
View ArticleJava 9 Flow API: mapping and filtering in one stage
IntroductionIn most reactive libraries, mapping and filtering can be done on a flow via separate operators map() and filter() respectively. One rare occasions, the functions to these operators would...
View ArticleRxJava vs. Kotlin Coroutines, a quick look
IntroductionDoes Kotlin Coroutines make RxJava and reactive programming obsolete? The answer depends on who you ask. Enthusiasts and marketing departments would say yes without hesitation. If so,...
View ArticleJava 9 Flow API: mapping asynchronously
IntroductionThere are cases where mapping an upstream value of type T has to be mapped to type U , one-for-one, but the mapping process itself involves asynchronous work. With RxJava, this is a...
View ArticleRewriting RxJava with Kotlin Coroutines?
IntroductionSomeone influential stated that RxJava should be rewritten with Kotlin Coroutines. I haven't seen any attempt of it as of now and declaring such a thing to be (not) worth without actually...
View ArticleJava 9 Flow API: ordered merge
IntroductionSometimes, one has several ordered sequences of events and would like to merge them into one single flow. Since one element from a sequence should come before another element in another...
View ArticleInteroperation between RxJava and Kotlin Coroutines
IntroductionWriting imperative-looking code with Kotlin Coroutines is certainly an attractive property of it, but I'd think things can get quite convoluted pretty fast once, for example, Selectors are...
View ArticleJava 9 Flow API: switching threads
IntroductionEnsuring certain computations happen on the right thread, usually off the main thread, is a very common development task when dealing with reactive flows. When building up tools for Java...
View ArticleJava 9 Flow API: timing out events
IntroductionOne of the main properties of reactive programming is that the events may arrive over time instead of immediately available to a consumer. In traditional Future-based programming, one could...
View ArticleJava 9 Flow API: arbitration and concatenation
IntroductionA very common task is to combine multiple sources, or more generally, start consuming a source once the previous source has terminated. The naive approach would be to simply call...
View ArticleJava 9 Flow API: taking and skipping
IntroductionLimiting or skipping over parts of a flow is a very common task: either we are only interested in the first N items or we don't care about the first N items. Sometimes, N is unknown but we...
View ArticleAndroid LiveData API: a quick look
IntroductionThreading and lifecycle are one of the top concerns when developing applications for the Android platform. UI has to be interacted with on a dedicated thread (main thread) but in order to...
View ArticleWhen multiple subscribeOn()s do have effect
IntroductionIn many tutorials and explanations, it has been said that having multiple subscribeOn()s has no effect and only the one closest to the source wins. I often tell this with the wording "no...
View ArticleJava 9 Flow API: Multicasting via a Processor
IntroductionThere are situations when the same elements of a source should be dispatched to multiple consumers. Certainly, if the source supports multiple subscribers and is deterministic (such as our...
View Article