|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jopendocument.util.CompareUtils
public class CompareUtils
| Nested Class Summary | |
|---|---|
static interface |
CompareUtils.Equalizer<T>
|
| Field Summary | |
|---|---|
static CompareUtils.Equalizer<java.lang.Object> |
OBJECT_EQ
|
| Constructor Summary | |
|---|---|
CompareUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
compare(java.util.List<T> l1,
java.util.List<T> l2,
CompareUtils.Equalizer<? super T> comp,
ITransformer<? super T,java.lang.String> toString)
Compare two lists using the provided comparator. |
|
static int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compare two objects if they're numbers or comparable. |
|
static int |
compareInt(int int1,
int int2)
|
|
static int |
compareIntNumbers(java.lang.Number n1,
java.lang.Number n2)
Compare 2 nombres entier avec longValue(). |
|
static int |
compareLong(long int1,
long int2)
|
|
static
|
createComparator(java.util.List<? extends java.util.Comparator<T>> comparators)
Renvoie un comparateur qui utilise successivement la liste passée tant que les objets sont égaux. |
|
static
|
equals(java.util.List<T> l1,
java.util.List<T> l2,
CompareUtils.Equalizer<? super T> comp)
|
|
static boolean |
equals(java.lang.Object o1,
java.lang.Object o2)
Compare 2 objets pouvant être null. |
|
static
|
equalsWithCompareTo(java.lang.Comparable<T> o1,
T o2)
Compare 2 objets pouvant être null avec compareTo(). |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final CompareUtils.Equalizer<java.lang.Object> OBJECT_EQ
| Constructor Detail |
|---|
public CompareUtils()
| Method Detail |
|---|
public static final int compareIntNumbers(java.lang.Number n1,
java.lang.Number n2)
n1 - le premier nombre.n2 - le deuxième nombre.
public static final int compareInt(int int1,
int int2)
public static final int compareLong(long int1,
long int2)
public static final int compare(java.lang.Object o1,
java.lang.Object o2)
throws java.lang.ClassCastException
o1 - first object.o2 - second object.
java.lang.ClassCastException - if o1 is neither a Number nor a Comparable, or if
o2's type prevents it from being compared to o1.
java.lang.NullPointerException - if o1 or o2 is null.Comparable.compareTo(Object),
NumberUtils.compare(Number, Number)public static final <T> java.util.Comparator<T> createComparator(java.util.List<? extends java.util.Comparator<T>> comparators)
T - type of comparatorcomparators - une liste de Comparator.
public static final boolean equals(java.lang.Object o1,
java.lang.Object o2)
null.
o1 - the first object, can be null.o2 - the second object, can be null.
true if both are null or if o1.equals(o2).Object.equals(Object)
public static final <T> boolean equalsWithCompareTo(java.lang.Comparable<T> o1,
T o2)
null avec compareTo(). Useful since for some
classes equals() is more specific than compareTo()==0, e.g. BigDecimal.equals(Object)
doesn't compare the numeric value but instance variables (1E2 is not equal to 100 or 100.00).
o1 - the first object, can be null.o2 - the second object, can be null.
true if both are null or if o1.compareTo(o2) == 0.Comparable.compareTo(Object)
public static final <T> boolean equals(java.util.List<T> l1,
java.util.List<T> l2,
CompareUtils.Equalizer<? super T> comp)
public static final <T> java.lang.String compare(java.util.List<T> l1,
java.util.List<T> l2,
CompareUtils.Equalizer<? super T> comp,
ITransformer<? super T,java.lang.String> toString)
T - type of itemsl1 - the first list.l2 - the second list.comp - how to compare each item.toString - how to dispay items, can be null.
null if the two lists are equal, otherwise a String explaining the
difference.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||