Summary
In this chapter, we discussed Kotlin extension functions and properties, both defined at the top level and as type member. We've seen how Kotlin standard library extension functions can be used to simplify collection processing and perform various operations. We have also described function types with a receiver together with function literals with a receiver. Also, we've seen a few important generic functions from the standard library that use extensions: let
, apply
, also
, with
, run
, and to
. Finally, we've seen how a DSL can be defined in Kotlin, and where it is useful.
In the next chapter, we will explore another feature that is not present in Java, but that provides a lot of functionality in Kotlin: class and property delegates.