requireNoNulls
Returns an original collection containing all the non-null elements, throwing an IllegalArgumentException if there are any null elements.
fun <T : Any> Sequence<T?>.requireNoNulls(): Sequence<T>(source)
val nullableInts = listOf(1, null, 3)
val nonNullInts: List<Int> = nullableInts
.asSequence()
.requireNoNulls()
.toList() // throws IllegalArgumentException because of the null