public class KeyedValueComparator extends java.lang.Object implements java.util.Comparator, java.io.Serializable
KeyedValue
instances
and sort them into ascending or descending order by key or by value.Constructor and Description |
---|
KeyedValueComparator(KeyedValueComparatorType type,
org.jfree.util.SortOrder order)
Creates a new comparator.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compares two
KeyedValue instances and returns an
int that indicates the relative order of the two objects. |
org.jfree.util.SortOrder |
getOrder()
Returns the sort order.
|
KeyedValueComparatorType |
getType()
Returns the type.
|
public KeyedValueComparator(KeyedValueComparatorType type, org.jfree.util.SortOrder order)
type
- the type (BY_KEY
or BY_VALUE
,
null
not permitted).order
- the order (null
not permitted).public KeyedValueComparatorType getType()
null
).public org.jfree.util.SortOrder getOrder()
null
).public int compare(java.lang.Object o1, java.lang.Object o2)
KeyedValue
instances and returns an
int
that indicates the relative order of the two objects.compare
in interface java.util.Comparator
o1
- object 1.o2
- object 2.