kv
07/23/2021, 6:28 PMmutableListOf<Pair?>
that I want to check the contents of. I try something like this on Kotlin 1.5.21:
fun foo(value: List<Pair?>): Boolean {
return list.contains(value)
}
I get the following error:
Type inference failed. The value of the type parameter T should be mentioned in input types (argument types, receiver type or expected type). Try to specify it explicitly.I can remove the error by modifying it to
return list.contains<Any?>(value)
but it feels like a weird work around. Anyone got insight as to the best way to approach this?ephemient
07/23/2021, 6:33 PM(Mutable)List<Pair?>
should never contain a List<Pair?>
element. do you mean containsAll
?Casey Brooks
07/23/2021, 6:36 PMlist
is List<List<Pair?>
. .containsAll
would check that all elements of value
are also elements of list
, where the two are both List<Pair?>
kv
07/23/2021, 6:41 PM