How is it possible to use different when
conditions for a variable? E.g. C should be added in every list here (except other
):
list.forEach {
when (it) {
is A -> listA.add(it)
is B -> listB.add(it)
is C -> listC.add(it)
else -> other.add(it)
}
}
interface A
interface B
interface C : A, B