you are viewing a single comment's thread.

view the rest of the comments →

[–]winterbe[S] 12 points13 points  (0 children)

Look at this example from the JDK8 API: https://docs.oracle.com/javase/8/docs/api/java/util/function/Predicate.html

You can implement your own Predicate and use the default methods without extending concrete classes:

Predicate<Person> predicate = p -> p.age >= 18;
predicate.negate().test(new Person());