Eliminate nulls from an Iterable and array
suggest changeSometimes we need to change type from Collection<T?>
to Collections<T>
. In that case, filterNotNull
is our solution.
val a: List<Int?> = listOf(1, 2, 3, null)
val b: List<Int> = a.filterNotNull()
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents