|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
public interface Comparator
This interface represents function prototype for a comparison function, which imposes a total ordering on some collection of objects.
It is used for example to sort a collection. A callback function
with the exact signature as compare(Object, Object)
is given to the sorting function and is then used to determine
the order of elements.
List.sort(Comparator)| Method Summary | |
|---|---|
int |
compare(Object o1,
Object o2)
Compares its two arguments for order. |
| Method Detail |
|---|
int compare(Object o1,
Object o2)
if (o1 < o2) return -1; if (o1 == o2) return 0; if (o1 > o2) return 1;
o1 - the first object to be compared.o2 - the second object to be compared.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||