public class CompositeComparator
extends java.lang.Object
implements java.util.Comparator
Constructor and Description |
---|
CompositeComparator(java.util.Comparator[] cmp)
Creates a new CompositeComparator.
|
CompositeComparator(java.util.Comparator[] cmp,
boolean reverse)
Creates a new CompositeComparator.
|
CompositeComparator(int size)
Creates an empty CompositeComparator with the given capacity.
|
CompositeComparator(int size,
boolean reverse)
Creates an empty CompositeComparator with the given capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.Comparator c)
Adds an additional comparator to this composite.
|
int |
compare(java.lang.Object o1,
java.lang.Object o2) |
boolean |
remove(java.util.Comparator c)
Removes a comparator from this composite.
|
public CompositeComparator(int size)
size
- the starting capacity of this comparatorpublic CompositeComparator(int size, boolean reverse)
size
- the starting capacity of this comparatorreverse
- when true, reverses the sort order of the included
comparators, when false, objects are sorted as usualpublic CompositeComparator(java.util.Comparator[] cmp)
cmp
- the constituent comparators of this compositepublic CompositeComparator(java.util.Comparator[] cmp, boolean reverse)
cmp
- the constituent comparators of this compositereverse
- when true, reverses the sort order of the included
comparators, when false, objects are sorted as usualpublic void add(java.util.Comparator c)
c
- the Comparator to addpublic boolean remove(java.util.Comparator c)
c
- the Comparator to removepublic int compare(java.lang.Object o1, java.lang.Object o2)
compare
in interface java.util.Comparator
Comparator.compare(java.lang.Object, java.lang.Object)
Copyright ? 2013 Regents of the University of California