compilation fix

This commit is contained in:
Maxim Shafirov
2013-02-13 16:14:33 +04:00
parent 63f88cdf65
commit b851c5597a
3 changed files with 15 additions and 4 deletions
+13
View File
@@ -67,3 +67,16 @@ public inline fun <T> List<T>.reduceRight(operation: (T, T) -> T) : T {
return r
}
/**
* Returns a original Iterable containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements
*/
public inline fun <T:Any> List<T?>.requireNoNulls() : List<T> {
for (element in this) {
if (element == null) {
throw IllegalArgumentException("null element found in $this")
}
}
return this as List<T>
}