Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Extension method in Kotlin to handle a method reference as a Handler
// It's weird it doesn't work ootb since Handler<T> is a functional java interface
// I must have missed something
fun <T> asHandler(handler: (T) -> Unit): Handler<T> =
Handler { event -> handler(event) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.