Reputation: 1271
Is there a way to do something like :
words.removeIf(specialWords::contains);
But by replacing "contains" by "startWith"
Upvotes: 0
Views: 402
Reputation: 1540
I would try the following:
words.removeIf(value -> specialWords.stream().anyMatch(value::startsWith));
This should remove every item from words
that start with any of the specialWords
.
Upvotes: 1