Predicate isEqual returns a predicate that tests if two arguments are equal according to Objects.equals(Object, Object).
isEqual
has the following syntax.
static <T> Predicate<T> isEqual(Object targetRef)
The following example shows how to use isEqual
.
import java.util.function.Predicate; /*w w w .ja v a 2 s .c om*/ public class Main { public static void main(String[] args) { Predicate<String> i = Predicate.isEqual("asdf"); System.out.println(i.test("java2s.com ")); } }
The code above generates the following result.