more elegant Iterable.all
This commit is contained in:
1 parent
464a6dcb99
commit
2ac92a1d09
1 file changed
+1
-6
@@ -103,12 +103,7 @@ fun Iterable.any(predicate): Bool {
|
||||
}
|
||||
|
||||
fun Iterable.all(predicate): Bool {
|
||||
for( i in this ) {
|
||||
if( !predicate(i) ) {
|
||||
break false
|
||||
}
|
||||
}
|
||||
else true
|
||||
!any { !predicate(it) }
|
||||
}
|
||||
|
||||
""".trimIndent()
|
||||
|
||||
Reference in new issue
Block a user