public class ListNestedSortComparator extends Object implements Comparator, Serializable
Typically, the lists are records in a collection that is to be sorted.
Records... { "a1", "b1", "c1" } { "a1", "b1", "c2" } { "a1", "b2", "c1" } { "a1", "b2", "c2" } { "a2", "b1", "c1" } { "a2", "b1", "c2" } { "a2", "b2", "c1" } { "a2", "b2", "c2" } Records sorted in ascending order on columns 0, 2... { "a1", "b1", "c1" } { "a1", "b2", "c1" } { "a1", "b2", "c2" } { "a1", "b1", "c2" } { "a2", "b1", "c1" } { "a2", "b2", "c1" } { "a2", "b1", "c2" } { "a2", "b2", "c2" }
Constructor and Description |
---|
ListNestedSortComparator(int[] sortParameters)
Constructs an instance of this class given the indicies of the parameters
to sort on, and whether the sort should be in ascending or descending
order.
|
ListNestedSortComparator(int[] sortParameters,
boolean ascending)
Constructs an instance of this class given the indicies of the parameters
to sort on, and whether the sort should be in ascending or descending
order.
|
ListNestedSortComparator(int[] sortParameters,
List orderTypes)
Constructs an instance of this class given the indicies of the parameters
to sort on, and orderList used to determine the order in which each column
is sorted.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(Object o1,
Object o2)
Compares its two arguments for order.
|
boolean |
isDistinct() |
void |
setDistinctIndex(int distinctIndex) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public ListNestedSortComparator(int[] sortParameters)
public ListNestedSortComparator(int[] sortParameters, boolean ascending)
public ListNestedSortComparator(int[] sortParameters, List orderTypes)
public boolean isDistinct()
public void setDistinctIndex(int distinctIndex)
public int compare(Object o1, Object o2)
The compare
method returns
compare
in interface Comparator
o1
- The first object being comparedo2
- The second object being comparedCopyright © 2019. All rights reserved.