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, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public CompositeComparator(java.util.Comparator<T> one, java.util.Comparator<T> two)
null
one
- the first comparator to use, may not be null
two
- the second comparator to use, may not be null
java.lang.NullPointerException
- if any specified comparator null
.public CompositeComparator(java.util.Comparator<T> one, java.util.Comparator<T> two, java.util.Comparator<T> three)
null
one
- the first comparator to use, may not be null
two
- the second comparator to use, may not be null
three
- the third comparator to use, may not be null
java.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.