Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
测试集合的所有项目是否与谓词匹配的最惯用的方法是什么?
任何项目?
为此有内置函数:
List(1,2,3,4).forall(x => x < 5) res0: Boolean = true
对于任何:
List(1,2,3,4).exists(x => x > 3) res1: Boolean = true