From 2ac92a1d0933af749f32d630f954d2b9a8f12f16 Mon Sep 17 00:00:00 2001 From: sergeych Date: Sun, 17 Aug 2025 18:21:52 +0300 Subject: [PATCH] more elegant Iterable.all --- .../kotlin/net/sergeych/lyng/stdlib_included/root_lyng.kt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lynglib/src/commonMain/kotlin/net/sergeych/lyng/stdlib_included/root_lyng.kt b/lynglib/src/commonMain/kotlin/net/sergeych/lyng/stdlib_included/root_lyng.kt index 154fadd..00cbea5 100644 --- a/lynglib/src/commonMain/kotlin/net/sergeych/lyng/stdlib_included/root_lyng.kt +++ b/lynglib/src/commonMain/kotlin/net/sergeych/lyng/stdlib_included/root_lyng.kt @@ -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()