Skip to content

Blog

87 posts · page 4 of 11

Generics in Kotlin

1 min read

I love template in C++ in the olden day. In many good languages that I had chance to come across, such as TypeScript, Java (it was added later) and Kotlin, they too also have the Generic code. Generi…

Scope function

1 min read

When I started doing Kotlin, the one that confused me the most was scope functions. However, once I understand what it is, it becomes my most favorite Kotlin feature. It makes code clear, concise and…

Resource Cleanup

1 min read

Using try, catch and finally blocks for resource cleanup is tedious and error-prone. In fact, Kotlin has a library functions that could help us to manage cleanup for us.

Nothing

1 min read

What is Nothing in Kotlin? Does it even exist? A Nothing return type indicates a function that never returns. This is usually a function that always throws an exception.

Check Instructions

1 min read

Check Instructions are like assert - they act like a constraints that must be met before it could proceed. Usually, they are used to validate function arguments and results. Check instructions typica…

Companion Object

1 min read

If you don't need to tie member functions to the object, consider for companion object. Regular class elements can access the elements of the companion object, but the companion object elements canno…