ewe.util
Class CompareArrayElements
java.lang.Object
ewe.util.CompareArrayElements
- All Implemented Interfaces:
- CompareInts
- public class CompareArrayElements
- extends Object
- implements CompareInts
This is an implementation of CompareInts which compares Objects in
an array. CompareInts objects are used for the Utils.sort() methods.
|
Constructor Summary |
CompareArrayElements(Object[] items,
Comparer comparer)
Creates a new CompareArrayElements which uses the specified Comparer to
compare objects in the specified array. |
|
Method Summary |
int |
compare(int one,
int two)
Compare the two integer values provided by treating them as indexes
into the array and then using the Comparer to compare the Objects
found at those indexes. |
CompareArrayElements
public CompareArrayElements(Object[] items,
Comparer comparer)
- Creates a new CompareArrayElements which uses the specified Comparer to
compare objects in the specified array.
- Parameters:
items - the items to compare.comparer - a Comparer to compare the objects in the array. If this is null
then it is assumed that the objects implement the Comparable interface.
compare
public int compare(int one,
int two)
- Compare the two integer values provided by treating them as indexes
into the array and then using the Comparer to compare the Objects
found at those indexes.
- Specified by:
compare in interface CompareInts