|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- the value type@Experimental public interface Predicate<T>
Represents a Predicate
, that is, a function with
one argument returning a boolean
value. It not extends
function since implementing this would entail
changing the signature of the Function.apply(F)
method
to return a Boolean
instead of a boolean
, which
would in turn allow people to return null
from their
predicate, which would in turn enable code that looks like
if (myPredicate.apply(myObject)) ...
to throw a
NullPointerException
.
Note: experimental - inspired by guice
Method Summary | |
---|---|
boolean |
equals(Object obj)
Indicates whether some other object is equal to this Predicate . |
boolean |
evaluate(T value)
Evaluates this predicate for the given value. |
Method Detail |
---|
boolean evaluate(@Nullable T value)
value
- a value to be evaluated; should not be changed.
boolean equals(Object obj)
Predicate
.
This method can return true
only if the specified object
is also a Predicate
and, for every input object o
, it
returns exactly the same value. Thus,
predicate1.equals(predicate2)
implies that either
predicate1.apply(o)
and predicate2.apply(o)
are both
true
, or both false
.
Note that it is always safe not to override
Object.equals(Object)
.
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |