From 2d7b76a122f7f1511ad011d584ce97aab7f8aad3 Mon Sep 17 00:00:00 2001 From: luming Date: Thu, 1 Jul 2021 14:18:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=83=E7=B4=A0=E7=BB=9F=E8=AE=A1=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/senior/Lambda/Collection.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/senior/Lambda/Collection.kt b/src/senior/Lambda/Collection.kt index 76d80e4..27becfa 100644 --- a/src/senior/Lambda/Collection.kt +++ b/src/senior/Lambda/Collection.kt @@ -30,4 +30,8 @@ fun main(args: Array) { // 查找所有满足条件的元素 println("element > 10 = ${list.filter { it >= 20 }}") + // 统计满足条件的元素个数 + println("element num > 10 = ${list.count { it >= 20 }}") + + } \ No newline at end of file