com.igormaznitsa.meta.common.interfaces.CheckedPredicate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of meta-utils Show documentation
Show all versions of meta-utils Show documentation
Set of utilities and auxiliary classes to make development easier.
The newest version!
package com.igormaznitsa.meta.common.interfaces;
import static java.util.Objects.requireNonNull;
/**
* Checked version of predicate.
*
* @param type of argument
* @since 1.2.1
*/
@FunctionalInterface
public interface CheckedPredicate {
boolean test(T t) throws Exception;
default CheckedPredicate and(CheckedPredicate super T> other) throws Exception {
requireNonNull(other);
return (t) -> test(t) && other.test(t);
}
default CheckedPredicate negate() throws Exception {
return (t) -> !test(t);
}
default CheckedPredicate or(CheckedPredicate super T> other) throws Exception {
requireNonNull(other);
return (t) -> test(t) || other.test(t);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy