Skip to content

Tag: kotlin

Return interface implementation with Kotlin and lambda

I have this simple interface : This interface is used in one function of a class : My question is : is there a way to simplify the return statement with a lambda ? I try some stuff like this but it doesn’t work : EDIT : Kotlin supports SAM interfaces now so declaring it like so : allows us

Kotlin: Cannot import-on-demand from object

I am trying to make a library where you can call functions of an object through “static imports” (import-on-demand in Kotlin). Unfortunately Kotlin seems to have a limitation as seen below. Why is this a limitation? Is there anything I can do to get around it? (I’ve tried using a class with a companion object and in that case the