Package org.zkoss.zul
Class ArrayComparator<E>
java.lang.Object
org.zkoss.zul.ArrayComparator<E>
- All Implemented Interfaces:
Serializable,Comparator<E>
Compares the specified element of the array.
It assumes the data passed to
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.- Since:
- 5.0.6
- Author:
- tomyeh
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
ArrayComparator
public ArrayComparator(int index, boolean ascending) The constructor.- Parameters:
index- which index of an array to compareascending- whether to sort as ascending (or descending).
-
-
Method Details
-
compare
- Specified by:
comparein interfaceComparator<E>
-
getIndex
public int getIndex()Returns the index of the element. -
isAscending
public boolean isAscending()Returns whether the sorting is ascending. -
equals
- Specified by:
equalsin interfaceComparator<E>- Overrides:
equalsin classObject
-
hashCode
public int hashCode()
-