公告
财富商城
积分规则
提问
发文
2019-03-14 07:28发布
唯我独甜
What's the most idiomatic way to test whether all items of a collection match a predicate?
Any item?
There are built-in functions for this:
List(1,2,3,4).forall(x => x < 5) res0: Boolean = true
for any:
List(1,2,3,4).exists(x => x > 3) res1: Boolean = true
最多设置5个标签!
There are built-in functions for this:
for any: