Java: Predicate

Veröffentlicht am: 15 März 2024
auf dem Kanal: HowTo:
20
5

This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

A Functional Interface is an Interface which allows only one Abstract method within the Interface scope. There are some predefined functional interface in Java like Predicate, consumer, supplier etc. The return type of a Lambda function (introduced in JDK 1.8) is a also functional interface.

The Functional Interface PREDICATE is defined in the java.util.function package. It improves manageability of code, helps in unit-testing them separately, and contain some methods like:
isEqual(Object targetRef) : Returns a predicate that tests if two arguments are equal according to Objects.equals(Object, Object).
and(Predicate other) : Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
negate() : Returns a predicate that represents the logical negation of this predicate.
or(Predicate other) : Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
test(T t) : Evaluates this predicate on the given argument.boolean test(T t)

00:00 - Intro
00:05 - Simple Predicate
00:22 - Predicate in Collection
01:13 - Predicate AND


Auf dieser Seite können Sie das Online-Video Java: Predicate mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer HowTo: 15 März 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 20 Mal angesehen und es wurde von 5 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!