org.nustaq.reallive.api.RLPredicate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reallive Show documentation
Show all versions of reallive Show documentation
persistent inmemory datagrid based on kontraktor
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 super T> other) {
Objects.requireNonNull(other);
return (t) -> test(t) && other.test(t);
}
default RLPredicate negate() {
return (t) -> !test(t);
}
default RLPredicate or(Predicate super T> 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;
}
}