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 {
|
fun Iterable.all(predicate): Bool {
|
||||||
for( i in this ) {
|
!any { !predicate(it) }
|
||||||
if( !predicate(i) ) {
|
|
||||||
break false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user