22 lines
587 B
Kotlin
22 lines
587 B
Kotlin
package kotlin
|
|
|
|
//
|
|
// NOTE THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt
|
|
// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib
|
|
//
|
|
|
|
import java.util.*
|
|
|
|
/**
|
|
* Returns a original Iterable containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
|
|
*/
|
|
public fun <T:Any> Collection<T?>.requireNoNulls() : Collection<T> {
|
|
for (element in this) {
|
|
if (element == null) {
|
|
throw IllegalArgumentException("null element found in $this")
|
|
}
|
|
}
|
|
return this as Collection<T>
|
|
}
|
|
|