more elegant Iterable.all

This commit is contained in:
sergeych committed 2025-08-17 18:21:52 +03:00
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()