public class CompositeComparator<T>
extends java.util.AbstractList<java.util.Comparator<T>>
implements java.util.Comparator<T>, java.util.List<java.util.Comparator<T>>
| Constructor and Description |
|---|
CompositeComparator(java.util.Comparator<T>... cs)
Constructs a composite comparator from an array of comparators.
|
CompositeComparator(java.util.Comparator<T> one,
java.util.Comparator<T> two)
Constructs a composite comparator from two of comparators.
|
CompositeComparator(java.util.Comparator<T> one,
java.util.Comparator<T> two,
java.util.Comparator<T> three)
Constructs a composite comparator from three of comparators.
|
CompositeComparator(java.util.List<? extends java.util.Comparator<T>> cs)
Constructs a composite comparator from an array of comparators.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(T one,
T two) |
java.util.Comparator<T> |
get(int index) |
int |
size() |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic CompositeComparator(java.util.Comparator<T> one, java.util.Comparator<T> two)
nullone - the first comparator to use, may not be nulltwo - the second comparator to use, may not be nulljava.lang.NullPointerException - if any specified comparator null.public CompositeComparator(java.util.Comparator<T> one, java.util.Comparator<T> two, java.util.Comparator<T> three)
nullone - the first comparator to use, may not be nulltwo - the second comparator to use, may not be nullthree - the third comparator to use, may not be nulljava.lang.NullPointerException - if any specified comparator null.public CompositeComparator(java.util.Comparator<T>... cs)
cs - the array of comparators in order of descending preference.
May not be null, nor contain null.java.lang.NullPointerException - if the specified array is null or if any of its
elements are null.public CompositeComparator(java.util.List<? extends java.util.Comparator<T>> cs)
cs - the list of comparators in order of descending preference.
May not be null, nor contain null.java.lang.NullPointerException - if the specified array is null or if any of its
elements are null.public java.util.Comparator<T> get(int index)
Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.