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 Functional Programming in JavaVenkat Subramaniam. Functional Programming in Java. The Pragmatic Bookshelf, Raleigh, NC, 2014. Kotlin’s Function doesn’t have that method, but we can inject an ...