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