Extending Functions
We'll cover the following...
How to extend
Functions are objects in Kotlin, and you can inject methods into functions, like you can inject methods into classes. In Java 8, the functional interface Function<T, R>
has an andThen()
method to combine two functions, and we can use this to compose operations—see Function
doesn’t have that method, but we can inject an ...