more elegant Iterable.all

This commit is contained in:
Sergey Chernov 2025-08-17 18:21:52 +03:00
parent 464a6dcb99
commit 2ac92a1d09

View File

@ -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()