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

org.nustaq.reallive.api.RLPredicate Maven / Gradle / Ivy

There is a newer version: 5.2.1
Show newest version
package org.nustaq.reallive.api;

import java.io.Serializable;
import java.util.Objects;
import java.util.function.Predicate;

/**
 * Created by ruedi on 14/08/15.
 *
 * make JDK's predicate serializable
 *
 */
public interface RLPredicate extends Predicate, Serializable {

    default RLPredicate and(Predicate other) {
        Objects.requireNonNull(other);
        return (t) -> test(t) && other.test(t);
    }

    default RLPredicate negate() {
        return (t) -> !test(t);
    }
    default RLPredicate or(Predicate other) {
        Objects.requireNonNull(other);
        return (t) -> test(t) || other.test(t);
    }
    static  RLPredicate isEqual(Object targetRef) {
        return (null == targetRef)
                ? Objects::isNull
                : object -> targetRef.equals(object);
    }

    default int getRecordLimit() {
        return 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy