Java 8 Functional Interfaces Java Java API
Interface:
java.util.function.BiPredicate<T,U>
Method:
default BiPredicate<T,U> and(BiPredicate<? super T,? super U> other)
Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
Examples
package com.logicbig.example.bipredicate;
import java.util.function.BiPredicate;
public class AndExample {
public static void main(String... args) { BiPredicate<String, String> startsWith = String::startsWith; BiPredicate<String, String> biPredicate = startsWith.and(String::endsWith); boolean b = biPredicate.test("enough is enough", "enough"); System.out.println(b); b = biPredicate.test("she is tall", "tall"); System.out.println(b); } }
Outputtrue false
|
|