dvdandroid
10/27/2021, 1:20 PMpublic fun <T> myFun(vararg arg: T) where T : MyClass, T : MyInterface
how can i create collection<T> (outside this function)?
what i should achieve is:
val x: Set<T> = setOf(a, b)
or like val x: Set<MyClass & MyInterface> = setOf(a, b)
if i remove the explicit type it works, but i need it for a function return type (type inference errors)Ruckus
10/27/2021, 2:44 PMStephan Schroeder
10/27/2021, 2:57 PM&
, like in`Set<MyClass & MyInterface>`, doesn't exists.
I was already surprised that I could double specify it for the generic function argument 😅smit01
10/27/2021, 9:34 PM