https://kotlinlang.org logo
Title
a

alexcouch

11/21/2017, 10:58 PM
Can KCallable be interchanged with Callable? I need to pass in a method reference to a Java method that uses Callable as a parameter but it seems as though that the kotlin function references aren't the same as Java, and they only work with KCallable. I tried to cast KCallable to Callable but I ended up getting a casting exception saying that they can't be casted properly. Is there some way to do this safely? Or is there a way to pass in a java method reference in kotlin?
a

Andreas Sinz

11/21/2017, 11:18 PM
@alexcouch you could use SAM conversion
a

alexcouch

11/21/2017, 11:32 PM
Excuse me?
a

alexcouch

11/22/2017, 12:11 AM
Lemme show the code that I have so you can better understand what I'm needing. I'm sure the SAM conversion is what I need but I need to know how to do it.
Nevermind I got it. Don't know what I did different but I got it. It was throwing errors last time but not anymore