@@ -0,0 +1,1577 @@
+package io.github.benas.xstream;%0A%0Aimport java.util.Objects;%0Aimport java.util.function.Predicate;%0A%0A/**%0A * This class consists of %7B@code static%7D factory methods to create commons predicates.%0A *%0A * @author Mahmoud Ben Hassine (mahmoud@benhassine.fr)%0A */%0Apublic class Predicates %7B%0A%0A    public static %3CT%3E Predicate%3CT%3E nonNull() %7B%0A        return Objects::nonNull;%0A    %7D%0A%0A    public static %3CT%3E Predicate%3CT%3E isNull() %7B%0A        return Objects::isNull;%0A    %7D%0A%0A    public static Predicate%3CString%3E empty() %7B%0A        return String::isEmpty;%0A    %7D%0A%0A    public static Predicate%3CString%3E contains(final String pattern) %7B%0A        Objects.requireNonNull(pattern, %22The pattern should not be null%22);%0A        return s -%3E s.contains(pattern);%0A    %7D%0A%0A    public static Predicate%3CString%3E startsWith(final String pattern) %7B%0A        Objects.requireNonNull(pattern, %22The pattern should not be null%22);%0A        return s -%3E s.startsWith(pattern);%0A    %7D%0A%0A    public static Predicate%3CString%3E endsWith(final String pattern) %7B%0A        Objects.requireNonNull(pattern, %22The pattern should not be null%22);%0A        return s -%3E s.endsWith(pattern);%0A    %7D%0A%0A    public static Predicate%3CString%3E matches(final String regexp) %7B%0A        Objects.requireNonNull(regexp, %22The regexp should not be null%22);%0A        return s -%3E s.matches(regexp);%0A    %7D%0A%0A    public static Predicate%3CNumber%3E even() %7B%0A        return s -%3E s.shortValue() %25 2 == 0;%0A    %7D%0A%0A    public static Predicate%3CNumber%3E odd() %7B%0A        return even().negate();%0A    %7D%0A%0A    public static Predicate%3CNumber%3E isZero() %7B%0A        return s -%3E s.shortValue() == 0;%0A    %7D%0A%7D%0A

add utility class to create common predicates