more elegant Iterable.all
This commit is contained in:
parent
464a6dcb99
commit
2ac92a1d09
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user