Functional Programming Java vs. Kotlin, Stateful Function Edition

Java vs. Kotlin, Stateful Function Edition

State encapsulation or lamba expression with closure when implementing stateful functions? Is Java or Kotlin better suited for either one of those 2 approaches? Let’s find out… Use case To compare implementations in Kotlin and Java, we will build a very simple feature, create a function that can count how many times it was called. …

Read Article Read More

Functional Programming Extension Function vs. Regular Function in Kotlin

Extension Function vs. Regular Function in Kotlin

I’m a big fan of extension functions in Kotlin, for me it’s another tool in our toolbox to give the developer additional options as an API designer or consumer, but this post is not about the philosophical discussion of the merits of extension functions, like the ability to chain utility functions vs. the issues that …

Read Article Read More

Kotlin When a Dog is Not Always an Animal…

When a Dog is Not Always an Animal…

This dog obviously doesn’t seems to agree with the title, but looks like the Kotlin compiler might have a different idea about this! Below is a very small experiment using the Spring Reactive Flux api from Project Reactor (version 3.1.7) to illustrate how sometimes a dog is not always an animal: It seems like directly …

Read Article Read More