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

org.simpleflatmapper.util.OrPredicate Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

The newest version!
package org.simpleflatmapper.util;

public final class OrPredicate implements Predicate {
    public final Predicate p1;
    public final Predicate p2;

    public OrPredicate(Predicate p1, Predicate p2) {
        this.p1 = p1;
        this.p2 = p2;
    }

    @Override
    public boolean test(T t) {
        return p1.test(t) && p2.test(t);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        OrPredicate that = (OrPredicate) o;

        if (p1 != null ? !p1.equals(that.p1) : that.p1 != null) return false;
        return p2 != null ? p2.equals(that.p2) : that.p2 == null;
    }

    @Override
    public int hashCode() {
        int result = p1 != null ? p1.hashCode() : 0;
        result = 31 * result + (p2 != null ? p2.hashCode() : 0);
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy