Java stream - purpose of having both anyMatch and noneMatch operations?

后端 未结 2 1280
一向
一向 2021-01-12 11:05

The anyMatch operation will return true if it finds an element - the noneMatch operation will return false it if finds a matching element.

The anyMatch operation wil

2条回答
  •  迷失自我
    2021-01-12 11:51

    Same reason you have a != b, instead of only supporting ! (a == b):

    • Easy of use.
    • Clarity of purpose.

提交回复
热议问题