Lambda Expressions in Java: Syntax and Examples

Functional Interface Predicate

1/3

What is the result of the code?

Predicate<String> predicate1 = t -> {
            System.out.print("predicate1");
            return t.startsWith(" ");
        };
Predicate<String> predicate2 = t -> {
            System.out.print("predicate2");
            return t.length() > 6;
        };
predicate1.and(predicate2).test("Hello world!!!");
Comments