How to work with inline properties
A great thing about Kotlin is high-order functions that let us use functions as parameters to other functions. However, they are objects, so they present memory overhead (because every instance is allocated space in heap, and we need methods for calling the functions too). We can improve the situation using inline functions. Inline annotation means that the specific function, along with the function parameters, will be expanded at the call site; this helps reduce call overhead.
Similarly, the inline keyword can be used with properties and property accessors that do not have the backing field. Let's see how in this recipe.
Getting ready
You need to install a preferred development environment that compiles and runs Kotlin. You can also use the command line for the purpose, for which you need Kotlin compiler installed along with JDK. I am using online IDE at https://try.kotlinlang.org/ to compile and run my Kotlin code for this recipe. You can also use IntelliJ...