This question is about the parameter callback in Kotlin, which is by the way a very nice feature from my point of view!
I have a method written in Kotlin like this one which expects a callback as argument. The callback itself expects a String argument, which should be given to the callback invocation reciever:
`private fun m1(number: Int, callback: (result: String) -> Unit) {
//some other stuff..
val string = "Foo"
callback.invoke(string)
}`
Then usually I would use it in Kotlin like this way:
m1(101) { processResult(it) }
Whereas it the actual result is
BUT... how to get and process the callback result if the caller of the method is a Java class? I tried something like this one but it does not work:
`m1(101, () -> processResult(result));`
Thanks for any help! See you later.