public class ArrayComparator<E>
extends java.lang.Object
implements java.util.Comparator<E>, java.io.Serializable
compare(E, E)
is an array, and
it compares the n-th element, where n is passed in the constructor,
ArrayComparator(int, boolean)
(the index parameter).
It also assumes the element must implement Comparable
.Constructor and Description |
---|
ArrayComparator(int index,
boolean ascending)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(E o1,
E o2) |
int |
getIndex()
Returns the index of the element.
|
boolean |
isAscending()
Returns whether the sorting is ascending.
|
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.