Package sunlabs.brazil.util
Interface Sort.Compare
-
- Enclosing class:
- Sort
public static interface Sort.Compare
This interface is used by theSort
class to compare elements when an array is being sorted.- Version:
- 2.2, 04/11/30
- Author:
- Colin Stevens (colin.stevens@sun.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
compare(java.lang.Object array, int index1, int index2)
Compare two elements in the given array.
-
-
-
Method Detail
-
compare
int compare(java.lang.Object array, int index1, int index2)
Compare two elements in the given array. The implementor must know what the actual type of the array is and cast it to that type in order to do the comparison.- Parameters:
array
- Array being sorted.index1
- The index in the given array of the first element to compare.index2
- The index in the given array of the second element to compare.- Returns:
- The implementation must return a number less than,
equal to, or greater than zero to indicate whether
the array element at
index1
should be considered less than, equal to, or greater than the array element atindex2
.
-
-