Well. The first is a method that generates a function, and you call it like this:
boolean test = isEmpty().test("Hello!");
Or, from a stream in a method in a class named World:
.filter(World::isEmpty())
The second is a field with a pregenerated function, and you call it like this:
boolean test = isEmpty.test("Hello!");
Or, from a stream in a method in a class named World:
.filter(World.isEmpty)
Notice how the method-based Predicate still has to generate a function, and thus has to be called with parentheses.
The field-based predicate already generated its function by the time it gets called, and because it's a field, no parentheses are used for accessing it.
Why Predicates at all, rather than a simple boolean-returning method?
So this year I decided it was really about time I applied for the
@vExpert subprograms, and guess what! I'm in! So Thanks to our Programme Manager @vCommunityGuy and Sub Programme Business Units!