All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.geraldnguyen.excel.Predicates Maven / Gradle / Ivy

The newest version!
package io.github.geraldnguyen.excel;

import lombok.NonNull;

import java.util.function.Predicate;

public class Predicates {
    public static  Predicate isEqual(@NonNull T constant) {
        return Predicate.isEqual(constant);
    }

    public static Predicate isTrue() {
        return isEqual(Boolean.TRUE);
    }

    public static Predicate isFalse() {
        return isEqual(Boolean.FALSE);
    }

    public static  Predicate notEqual(@NonNull T constant) {
        return Predicate.not(Predicate.isEqual(constant));
    }

    public static > Predicate greaterThan(@NonNull T constant) {
        return t -> t.compareTo(constant) > 0;
    }

    public static > Predicate greaterThanOrEqual(@NonNull T constant) {
        return t -> t.compareTo(constant) >= 0;
    }

    public static > Predicate lessThan(@NonNull T constant) {
        return t -> t.compareTo(constant) < 0;
    }

    public static > Predicate lessThanOrEqual(@NonNull T constant) {
        return t -> t.compareTo(constant) <= 0;
    }

    public static Predicate startWith(@NonNull String constant) {
        return s -> s.startsWith(constant);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy