public class

TransformingComparator

extends Object
implements Comparator<T>
java.lang.Object
   ↳ org.apache.commons.collections.comparators.TransformingComparator

Class Overview

Decorates another Comparator with transformation behavior. That is, the return value from the transform operation will be passed to the decorated compare method.

Summary

Fields
protected Comparator decorated The decorated comparator.
protected Transformer transformer The transformer being used.
Public Constructors
TransformingComparator(Transformer transformer)
Constructs an instance with the given Transformer and a ComparableComparator.
TransformingComparator(Transformer transformer, Comparator decorated)
Constructs an instance with the given Transformer and Comparator.
Public Methods
int compare(Object obj1, Object obj2)
Returns the result of comparing the values from the transform operation.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.Comparator

Fields

protected Comparator decorated

The decorated comparator.

protected Transformer transformer

The transformer being used.

Public Constructors

public TransformingComparator (Transformer transformer)

Constructs an instance with the given Transformer and a ComparableComparator.

Parameters
transformer what will transform the arguments to compare

public TransformingComparator (Transformer transformer, Comparator decorated)

Constructs an instance with the given Transformer and Comparator.

Parameters
transformer what will transform the arguments to compare
decorated the decorated Comparator

Public Methods

public int compare (Object obj1, Object obj2)

Returns the result of comparing the values from the transform operation.

Parameters
obj1 the first object to transform then compare
obj2 the second object to transform then compare
Returns
  • negative if obj1 is less, positive if greater, zero if equal