altavir
07/06/2025, 1:14 PMcombine
method. For some reason it accepts Array
instead of List
and has reified type. It does not make a lot of sense since the type is not used everywhere.
I have a place where reification is not possible and it looks really Ugly:
override val valueFlow: Flow<R> = combine<Any, R>(states.map { it.valueFlow } as Iterable<Flow<Any>>){ array: Array<Any>->
mapper(array.asList() as List<T>)
}
altavir
07/06/2025, 1:15 PMephemient
07/06/2025, 6:15 PMArray<T>
without reified T
, and combine
internally reuses the array across calls for efficiency in internal users, and creates a new one for safety of public users but maintains the same apiephemient
07/06/2025, 6:20 PMoverride val valueFlow: Flow<R> = combine(states.map { it.valueFlow }) { array: Array<Any?> ->
mapper(array.asList() as List<T>)
}
altavir
07/06/2025, 7:42 PMephemient
07/06/2025, 7:44 PMArray<T>
is special and (unlike generics) requires reificationaltavir
07/06/2025, 7:46 PMArray
).