Vampire
03/13/2021, 8:49 PMFunction1
but as consumer, so without return value?Youssef Shoaib [MOD]
03/13/2021, 9:08 PMFunction1<T, Unit>
should do the job just fine. Or alternatively if you need a proper interface use a fun interface Consumer<T> { fun consume(t: T): Unit }
Vampire
03/14/2021, 12:44 AMFunction1<T, Unit>
was exactly what I neededRuckus
03/14/2021, 3:44 AM(T) -> Unit
?louiscad
03/14/2021, 8:17 AMFunction0
, or just use the functional type (you can implement it like an interface).Vampire
03/14/2021, 11:29 AMFunction0
would give me 0 parameters and 0 or 1 return type, but I needed 1 parameter and 0 return type, so Function1<T, Unit>
was exactly what I needed.
(T) -> Unit
didn't work because I needed it as generic type argument like object : TypeOf<Function1<T, Unit>>() {}
Youssef Shoaib [MOD]
03/14/2021, 1:23 PMobject : TypeOf<(T) -> Unit>() {}
would still work just fineVampire
03/14/2021, 4:46 PM