public class

KeyedValueComparator

extends Object
implements Comparator<T>
java.lang.Object
   ↳ org.jfree.data.KeyedValueComparator

Class Overview

A utility class that can compare and order two KeyedValue instances and sort them into ascending or descending order by key or by value.

Summary

Public Constructors
KeyedValueComparator(KeyedValueComparatorType type, SortOrder order)
Creates a new comparator.
Public Methods
int compare(Object o1, Object o2)
Compares two KeyedValue instances and returns an int that indicates the relative order of the two objects.
SortOrder getOrder()
Returns the sort order.
KeyedValueComparatorType getType()
Returns the type.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.Comparator

Public Constructors

public KeyedValueComparator (KeyedValueComparatorType type, SortOrder order)

Creates a new comparator.

Parameters
type the type (BY_KEY or BY_VALUE, null not permitted).
order the order (null not permitted).

Public Methods

public int compare (Object o1, Object o2)

Compares two KeyedValue instances and returns an int that indicates the relative order of the two objects.

Parameters
o1 object 1.
o2 object 2.
Returns
  • An int indicating the relative order of the objects.

public SortOrder getOrder ()

Returns the sort order.

Returns
  • The sort order (never null).

public KeyedValueComparatorType getType ()

Returns the type.

Returns
  • The type (never null).