Eliminate nulls from an Iterable and array

suggest change

Sometimes we need to change the type from Collection<T?> to Collection<T>. In that case, filterNotNull is the solution.

val a: List<Int?> = listOf(1, 2, 3, null)
val b: List<Int> = a.filterNotNull()

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents