public class ListNestedSortComparator<T extends Comparable<? super T>> extends Object implements Comparator<List<T>>
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<Boolean> 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(List<T> list1,
List<T> list2)
Compares its two arguments for order.
|
ListNestedSortComparator<T> |
defaultNullOrder(ExecutionFactory.NullOrder order) |
List<Boolean> |
getOrderTypes() |
int[] |
getSortParameters() |
boolean |
isDistinct() |
void |
setDistinctIndex(int distinctIndex) |
void |
setNullOrdering(List<SortSpecification.NullOrdering> nullOrdering) |
void |
setOrderTypes(List<Boolean> orderTypes) |
void |
setSortParameters(int[] sortParameters) |
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<T> defaultNullOrder(ExecutionFactory.NullOrder order)
public boolean isDistinct()
public void setDistinctIndex(int distinctIndex)
public void setNullOrdering(List<SortSpecification.NullOrdering> nullOrdering)
public int compare(List<T> list1, List<T> list2)
The compare
method returns
compare
in interface Comparator<List<T extends Comparable<? super T>>>
o1
- The first object being comparedo2
- The second object being comparedpublic int[] getSortParameters()
public void setSortParameters(int[] sortParameters)
Copyright © 2019. All rights reserved.