Add Predicate.of(), Consumer.of(), etc.

Stephen Colebourne scolebourne at joda.org
Wed May 6 14:06:18 UTC 2015


On 6 May 2015 at 14:53, Paul Sandoz <paul.sandoz at oracle.com> wrote:
>>> In some respects i wonder if the default methods on the functional interfaces are an attractive nuisance.
>>
>> Meaning, if .negate(Predicate) were a static method on the Predicate class instead of a default method, then stream.filter(Predicate.negate(String::isEmpty)) would be possible? Yeah…
>>
>
> Yeah. We are now in the unfortunate position where to alleviate this problem we might require duplicate static and default methods. I have been sitting on the issue a bit and nearly closed it a few times :-)

I like Remi's solution. It may not be ideal, but it is very practical
and easy to explain on Stack Overflow. Duplicate static/default
methods would be much worse.

I also think that filterNot should be added to stream. Its just too
common a case.

Stephen



More information about the core-libs-dev mailing list