是否有一个Java 1.5等同于predicate< T>在.NET方法?有一个、方法、Java、predicate

2023-09-04 00:54:12 作者:万人中央我独殇

具体而言,我正在寻找类似的清洁符号的收藏< T> .TrueForAll / 存在,等等。

Specifically, I'm looking for similarly clean notation to the Collection<T>.TrueForAll / Exists, etc.

感觉有异味​​有写一个foreach循环来检查每个对象的方法的返回,所以我希望有一个更好的Java成语吧。

It feels smelly to have to write a foreach loop to inspect the return of a method on each object, so I'm hoping there's a better Java idiom for it.

推荐答案

$p$pdicates在谷歌集合库提供。