July 2018
Intermediate to advanced
242 pages
8h 6m
English
While working on implementing new features or refactoring of existing code, we often end up extracting some part of the code to functions in order to reuse them in different places. If the extracted function is atomic enough, we often end up exporting it to external utility classes whose primary purpose is to extend functionalities of existing classes. Kotlin provides an interesting alternative to the utility classes. It offers a built-in feature allowing us to extend functionalities of other classes with extension functions and extension properties.
In this recipe, we are going to extend the functionality of the Array<T> class and add a swap(a:T, b: T) extension function to it, which is responsible for ...
Read now
Unlock full access