dmitry.petrov
03/28/2016, 3:58 PMimport java.util.function.Consumer
class Example(val name: String) {
fun foo() { println("Hello, $name!") }
}
fun <T> consumer(f: KFunction<Unit>) =
Consumer<T> { t -> f.call(t) }
val test = consumer<Example>(Example::foo)
fun main(args: Array<String>) {
test.accept(Example("world"))
}