dave08
07/08/2020, 10:19 AMinterface Something {
fun foo(bar: Int): List<Int>
}
class SomethingImpl : Something {
//...
}
val ref = Something::foo
and I want to invoke it, do I do this:
val instance = SomethingImpl()
ref.invoke(instance, 5)
?marstran
07/08/2020, 10:26 AMstreetsofboston
07/08/2020, 10:30 AMref.invoke(instance, 5) as instance.ref(5).dave08
07/08/2020, 10:57 AMref might be null, I could still write instance?.ref(5) ? It seems to turn out red in Intellij...dave08
07/08/2020, 10:58 AMdave08
07/08/2020, 10:59 AMNamedGroups.. and then I do:
val namedGroup = (NamedGroups.firstOrNull { it.first.id === groupId }?.second)dave08
07/08/2020, 10:59 AMnamedGroup?.invoke(storeRepository, user.storeId)dave08
07/08/2020, 11:00 AMdave08
07/08/2020, 11:00 AMstreetsofboston
07/08/2020, 11:18 AMref can't be null. (instance can be null, though).dave08
07/08/2020, 11:23 AMdave08
07/08/2020, 11:28 AMKSuspendFunction2? Maybe suspend functions don't support this?dave08
07/08/2020, 11:28 AMstreetsofboston
07/08/2020, 11:57 AMval ref: Something.(Int) -> List<Int> = Something::foo
dave08
07/08/2020, 12:26 PMdave08
07/08/2020, 12:26 PMdave08
07/08/2020, 12:26 PM