I\'m trying to search a scala collection for an item in a list that matches some predicate. I don\'t necessarily need the return value, just testing if the list contains it.
The scala way would be to use exists:
exists
collection.exists(item => condition1(item) && condition2(item))
And since java 8 you can use anyMatch:
anyMatch
collection.stream().anyMatch(item -> condition1(item) && condition2(item));
which is much better than a plain for or foreach.