Modifier and Type | Method and Description |
---|---|
static Predicate<Object> |
after(long expirationTime)
Deprecated.
Use "
PredicateUtil . ignoreSubject ( ProducerUtil . after ( expirationTime)) " instead |
static <T> Predicate<T> |
always() |
static <T> Predicate<T> |
always(boolean value) |
static <T> Predicate<T> |
and(boolean lhs,
Predicate<? super T> rhs)
|
static <T> Predicate<T> |
and(Predicate<? super T> lhs,
boolean rhs)
|
static <T> Predicate<T> |
and(Predicate<? super T> lhs,
Predicate<? super T> rhs)
|
static <T,EX extends RuntimeException> |
asPredicate(PredicateWhichThrows<T,EX> source)
Converts a
PredicateWhichThrows into a Predicate , which is possible iff the source's exception
is a subclass of RuntimeException and the source's element type is a subclass of the target's element
type. |
static <T,EX extends Throwable> |
asPredicateWhichThrows(Predicate<? super T> source)
Converts a
Predicate into a PredicateWhichThrows , which is possible iff the source's element
type is a subclass of the target's element type. |
static <T> Predicate<T> |
atMostEvery(long milliseconds)
Deprecated.
Use "
PredicateUtil . ignoreSubject ( ProducerUtil . atMostEvery ( milliseconds)) " instead |
static <C extends Comparable<C>> |
between(C min,
C max) |
static <T> Predicate<T> |
contains(Collection<? extends T> collection) |
static <K> Predicate<K> |
containsKey(Map<K,?> map) |
static <K> Predicate<K> |
containsKey(Mapping<K,?> mapping) |
static <C extends Comparable<C>> |
equal(C other) |
static <T> Predicate<T> |
equal(T other)
Value equality, as opposed to arithmetical equality.
|
static <T extends Predicate<String>> |
forString(String format,
T delegate)
Returns a predicate that evaluates the format against the delegate after each "*" in the
format has been replaced with the subject.
|
static <C extends Comparable<C>> |
greater(C other) |
static <C extends Comparable<C>> |
greaterEqual(C other) |
static <T,EX extends Throwable> |
ignoreExceptions(Class<EX> exceptionClass,
PredicateWhichThrows<T,EX> delegate,
boolean defaultValue)
Wraps the delegate such that its declared exception is caught, ignored, and the
defaultValue is returned.
|
static <T,EX extends Throwable> |
ignoreSubject(Producer<Boolean> delegate) |
static <T,EX extends Throwable> |
ignoreSubject(ProducerWhichThrows<Boolean,EX> delegate) |
static <C extends Comparable<C>> |
less(C other) |
static <C extends Comparable<C>> |
lessEqual(C other) |
static <T> Predicate<T> |
never() |
static <T> Predicate<T> |
not(boolean value)
|
static <T> Predicate<T> |
not(Predicate<? super T> delegate) |
static <C extends Comparable<C>> |
notEqual(C other) |
static <T> Predicate<T> |
notEqual(T other)
Value inequality.
|
static <T> Predicate<T> |
or(boolean lhs,
Predicate<? super T> rhs)
Returns a
Predicate which evaluates to true if the lhs is true , or the
rhs evaluates to true , or both. |
static <T> Predicate<T> |
or(Predicate<? super T> lhs,
boolean rhs)
|
static <T> Predicate<T> |
or(Predicate<? super T> lhs,
Predicate<? super T> rhs)
|
static <T,EX extends Throwable> |
or(PredicateWhichThrows<? super T,? extends EX> lhs,
PredicateWhichThrows<? super T,? extends EX> rhs)
|
static <T,EX extends Throwable> |
synchronizedPredicate(PredicateWhichThrows<? super T,EX> delegate)
Creates and returns a proxy to the delegate with a synchronized
evaluate() method. |
static <T> Predicate<T> |
xor(boolean lhs,
Predicate<? super T> rhs) |
static <T> Predicate<T> |
xor(Predicate<? super T> lhs,
boolean rhs) |
static <T> Predicate<T> |
xor(Predicate<? super T> lhs,
Predicate<? super T> rhs) |
public static <T> Predicate<T> always(boolean value)
Predicate
which evaluates to the value (regardless of the subject)public static <T> Predicate<T> always()
Predicate
which evaluates to true
(regardless of the subject)public static <T> Predicate<T> never()
Predicate
which evaluates to false
(regardless of the subject)@Deprecated public static <T> Predicate<T> atMostEvery(long milliseconds)
PredicateUtil
.
ignoreSubject
(
ProducerUtil
.
atMostEvery
(
milliseconds))
" insteadPredicate
for which the first evaluation will yield true
, and,
after that, the time interval between adjacent true
evaluations will (A) be minimal and (B) never
shorter than milliseconds.public static <T> Predicate<T> and(Predicate<? super T> lhs, boolean rhs)
Predicate
which evaluates to true
iff both the rhs is true
and the lhs evaluates to true
.
Notice that iff the rhs is false
, then the lhs will ever be evaluated.
public static <T> Predicate<T> and(boolean lhs, Predicate<? super T> rhs)
Predicate
which evaluates to true
iff both the lhs is true
and
the rhs evaluates to true
.
Notice that iff the lhs is false
, then the rhs will ever be evaluated.
public static <T,EX extends Throwable> PredicateWhichThrows<? super T,? extends EX> or(PredicateWhichThrows<? super T,? extends EX> lhs, PredicateWhichThrows<? super T,? extends EX> rhs)
public static <T> Predicate<T> or(Predicate<? super T> lhs, boolean rhs)
Predicate
which evaluates to true
the lhs evaluates to true
, or the
rhs is true
, or both.
Notice that iff the rhs is true
, then the lhs will ever be evaluated.
public static <T> Predicate<T> or(boolean lhs, Predicate<? super T> rhs)
Predicate
which evaluates to true
if the lhs is true
, or the
rhs evaluates to true
, or both.
Notice that iff the lhs is true
, then the rhs will ever be evaluated.
public static <T> Predicate<T> xor(Predicate<? super T> lhs, Predicate<? super T> rhs)
Predicate
which evaluates to true
iff exactly one of lhs or
rhs evaluate to true
public static <T> Predicate<T> xor(Predicate<? super T> lhs, boolean rhs)
Predicate
which evaluates to true
iff either the lhs evaluates to true
and rhs is false
, or the lhs evaluates to false
and
rhs is true
public static <T> Predicate<T> xor(boolean lhs, Predicate<? super T> rhs)
Predicate
which evaluates to true
iff either lhs is true
and the
rhs evaluates to false
, or the lhs is false
and the
rhs evaluates to true
public static <T> Predicate<T> not(Predicate<? super T> delegate)
Predicate
which evaluates to true
iff the delegate evaluates to false
public static <T> Predicate<T> not(boolean value)
Predicate
which evaluates to the negation of the value (regardless of the subject)public static <C extends Comparable<C>> Predicate<C> less(C other)
Predicate
which evaluates to true
for any subject that is less than the
otherpublic static <C extends Comparable<C>> Predicate<C> lessEqual(C other)
Predicate
which evaluates to true
for any given subject that is less than or
equal to the otherpublic static <C extends Comparable<C>> Predicate<C> greater(C other)
Predicate
which evaluates to true
for any given subject that is greater
than the otherpublic static <C extends Comparable<C>> Predicate<C> greaterEqual(C other)
Predicate
which evaluates to true
for any given subject that is greater
than or equal to the otherpublic static <C extends Comparable<C>> Predicate<C> equal(C other)
Predicate
which evaluates to true
for any given
subject that is (arithmetically) equal to the otherComparable.compareTo(Object)
public static <C extends Comparable<C>> Predicate<C> notEqual(C other)
Predicate
which evaluates to true
for any given
subject that is (arithmetically) not equal to the otherComparable.compareTo(Object)
public static <C extends Comparable<C>> Predicate<C> between(C min, C max)
<=
subject <= max", or, if
min >
max, to "subject >=
min ||
subject <=
max"public static <T> Predicate<T> equal(T other)
equal(Comparable)
public static <T> Predicate<T> notEqual(T other)
@Deprecated public static Predicate<Object> after(long expirationTime)
PredicateUtil
.
ignoreSubject
(
ProducerUtil
.
after
(
expirationTime))
" insteadPredicate
<Object>
" that evaluates to true
iff the current time is after the
given expirationTime (in milliseconds).
(The returned predicate ignores its subject argument.)
expirationTime
- Milliseconds since Jan 1 1970, UTCpublic static <T extends Predicate<String>> T forString(String format, T delegate)
public static <T,EX extends Throwable> PredicateWhichThrows<T,EX> asPredicateWhichThrows(Predicate<? super T> source)
Predicate
into a PredicateWhichThrows
, which is possible iff the source's element
type is a subclass of the target's element type.T
- The subject typeEX
- The target predicate's exceptionpublic static <T,EX extends RuntimeException> Predicate<T> asPredicate(PredicateWhichThrows<T,EX> source)
PredicateWhichThrows
into a Predicate
, which is possible iff the source's exception
is a subclass of RuntimeException
and the source's element type is a subclass of the target's element
type.T
- The predicate subject typeEX
- The source predicate's exceptionpublic static <T> Predicate<T> contains(Collection<? extends T> collection)
public static <K> Predicate<K> containsKey(Map<K,?> map)
Predicate
that evaluates to true
iff the map contains a key equal to the
predicate subjectpublic static <K> Predicate<K> containsKey(Mapping<K,?> mapping)
Predicate
that evaluates to true
iff the mapping contains a key equal to the
predicate subjectpublic static <T,EX extends Throwable> PredicateWhichThrows<T,EX> ignoreSubject(ProducerWhichThrows<Boolean,EX> delegate)
public static <T,EX extends Throwable> Predicate<T> ignoreSubject(Producer<Boolean> delegate)
public static <T,EX extends Throwable> Predicate<T> ignoreExceptions(Class<EX> exceptionClass, PredicateWhichThrows<T,EX> delegate, boolean defaultValue)
public static <T,EX extends Throwable> PredicateWhichThrows<T,EX> synchronizedPredicate(PredicateWhichThrows<? super T,EX> delegate)
evaluate()
method.PredicateWhichThrows
Copyright © 2018 Arno Unkrig. All rights reserved.