Kotlin – Regulate a set of broadcasts to listener via Mediator Pattern

The definition of “mediator” is, a person who attempts to make people involved in a conflict come to an agreement; a go-between. Problem Solution The Mediator pattern suggests that all direct communication should be ceased between the components. Instead, these components must collaborate indirectly, by calling a special mediator object that redirects the calls to... » read more

Kotlin – Tips & Tricks

You may try this with Kotlin Playground -> https://play.kotlinlang.org Swap two values w/o temp variable a = b.also { b = a } is equivalent to followings: Enum Reverse Look-up

Kotlin – Idiomatic Way to Deal with Null-able

In Kotlin, a null-able value without being sure it is not null cannot be accessed. (Checking for null in conditions), or asserting that it is surely not null using the !! sure operator, accessing it with a ?. Safe Call, or lastly giving something that is possibly null a default value using the ?: Elvis... » read more

Kotlin – How to achieve Open-Closed Principle with Enum

Kotlin/Java enums are very powerful and important part of the Java language. Even though they can do so much, it is very common to see them either being used incorrectly or not used at all. In this blog post I want to remind you what Java enums can do and show some of the usage... » read more

Kotlin – How to Make Use of Extension Methods

Extension methods enable you to “add” methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Add retry() into Java Runnable class Reference Extension Methods in C#

Kotlin – Use EnumSet For RBAC

Enumset is a powerful collection in Java to replace bit fields. This article will explains how to use EnumSet to create a RBAC (Role-Based Access Control). Now, let’s see how we can use EnumSet to create a RBAC. Inside the setup method, a series of roles with specific access right in a given system has been defined... » read more