August 2017
Intermediate to advanced
440 pages
10h
English
The Kotlin standard library provide a set of extension functions (let, apply, also, with, run, and to) with generic non-restricted receivers (generic types have no restrictions). They are small and handy extensions, and it is very profitable to understand them, because they are very useful across all Kotlin projects. One of these functions, let, was briefly introduced in Chapter 2, Laying a Foundation, where we saw how it can be used as an alternative to a nullity check:
savedInstanceState?.let{ state ->
println(state.getBoolean("isLocked"))
}
All that let does is call the specified function and return its result. While in the preceding example it is used together with a safe call operator, it will be called ...
Read now
Unlock full access