Michael Marshall
03/03/2022, 6:55 AMfun interface MyInterface {
fun myMethod(): Int
}
which can be created with a lambda
val myInterface: MyInterface = { 4 }
but is there an equivalent for single abstract property interfaces? It could look like
fun interface MyInterface {
val myProperty(): Int
}
and be called like
val myInterface: MyInterface = 4
Michael Marshall
03/03/2022, 7:12 AMtypealias
, as explained in
https://kotlinlang.org/docs/fun-interfaces.html#sam-conversions