https://kotlinlang.org logo
l

locke

06/01/2018, 3:54 PM
Turns out that computing a map inversion is very fast for the size of the data sets I need to work with, so I just wrote an inversion extension function. New questions, though. Is there a way to pass a method reference as an argument, that can then be executed on an instance of the class the method belongs to? I.e.
Copy code
interface FooInterface {
    fun foo()
    fun bar() 
}


fun queryFooInterface(target: FooInterface, method: <Method>) {
    target.invokeMethod(method) 
}
Something along those lines?