July 2018
Intermediate to advanced
242 pages
8h 6m
English
The Kotlin standard library uses the infix notation extensively. You can benefit from infix functions to shape your code the clean way. One infix function worth noting is the to() extension function provided for the Map.Entry<K, V> class, which allows you to declare map entries in a minimalistic way:
val namesWithBirthdays: Map<String, LocalDate> = mapOf("Agata" to LocalDate.of(1990, 1, 18))
The to() extension function is declared for a generic type A and generic argument of type B, which returns an instance of a Pair<A, B> class.
There are plenty of other functions supporting infix notations available in the standard library. If you check the implementation of the ones you are using on a daily basis, it may turn out they ...
Read now
Unlock full access