|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.staccatocommons.lang.predicate.Equiv
public class Equiv
Factory class methods for creating common, simple Predicate2 that
implement the notion of and equivalence test, that is, a reflexive, symmetric
and transitive relation between its arguments.
Object.equals(Object)| Method Summary | ||
|---|---|---|
static
|
compare()
Answers an Predicate2 that performs an compare test between its
Comparable arguments, that it returns
arg0.compareTo(arg1) == 0 |
|
static
|
equal()
Answers an Predicate2 that performs an equality test between its
arguments, that it returns true if both are equal |
|
static
|
equalNullSafe()
Answers an Predicate2 that performs an equality test between its
nullable arguments, that it returns true if both are equal or null. |
|
static
|
on(net.sf.staccatocommons.defs.Applicable<? super A,? extends B> function)
Answers an Predicate2 that performs an equality test to the result
of applying the given function to its arguments. |
|
static
|
same()
Answers an Predicate2 that performs an identity test between its
arguments, that it returns true if both are the same object |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
@Constant public static <A> net.sf.staccatocommons.defs.predicate.Predicate2<A,A> same()
Predicate2 that performs an identity test between its
arguments, that it returns true if both are the same object
A -
Predicate2 that performs an identity test@Constant public static <A> net.sf.staccatocommons.defs.predicate.Predicate2<A,A> equal()
Predicate2 that performs an equality test between its
arguments, that it returns true if both are equal
A -
Predicate2 that performs an equality test@Constant public static <A> net.sf.staccatocommons.defs.predicate.Predicate2<A,A> equalNullSafe()
Predicate2 that performs an equality test between its
nullable arguments, that it returns true if both are equal or null.
A -
Equiv.equal().nullSafe()@Constant public static <A extends Comparable<A>> net.sf.staccatocommons.defs.predicate.Predicate2<A,A> compare()
Predicate2 that performs an compare test between its
Comparable arguments, that it returns
arg0.compareTo(arg1) == 0
A -
Predicate2 that performs a compare test
public static <A,B> net.sf.staccatocommons.defs.predicate.Predicate2<A,A> on(@NonNull
net.sf.staccatocommons.defs.Applicable<? super A,? extends B> function)
Predicate2 that performs an equality test to the result
of applying the given function to its arguments.
This is mostly useful then the given function is just a property accesor,
for example, the following code will answer an Predicate2 that
compares Employees names:
Equivalence.on(new Function<Customer, String>() {
public String apply(Customer cus) {
return cust.getName();
}
});
A - B - function -
Predicate2
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||