amaembo / streamex

Enhancing Java Stream API
Apache License 2.0
2.18k stars 249 forks source link

Opposite analog of filter(Predicate) with invert logic #235

Closed Ksnz closed 3 years ago

Ksnz commented 3 years ago

There are a lot of cases where i have to use ! mark in filter method. E.g. .filter(campaignId -> !lastActualizedDates.getOrDefault(campaignId, LocalDate.MIN).isAfter(period.getTo())) or write a lot of verbose code to avoid that.

It would be nice to have a method like skipWhen(Predicate) or skipIf(Predicate) or just skip(Predicate) to write more safe and less brain-breaking or verbose code.

amaembo commented 3 years ago

There's a remove method that behaves exactly opposite to filter. Well probably the name is not very ideal.