common-util

local.tomas.util.collections
Class MappedComparator<F,T>

java.lang.Object
  extended by local.tomas.util.collections.MappedComparator<F,T>
Type Parameters:
F - original operand type
T - mapped operand type
All Implemented Interfaces:
Comparator<F>

public class MappedComparator<F,T>
extends Object
implements Comparator<F>

Mapped comparator. A mapped comparator maps each operand through a mapping before comparing them.

Author:
tomas.teubner

Constructor Summary
MappedComparator(Comparator<? super T> comp, ObjectMapping<T> mapping)
          Construct mapped comparator.
 
Method Summary
 int compare(F o1, F o2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

MappedComparator

public MappedComparator(Comparator<? super T> comp,
                        ObjectMapping<T> mapping)
Construct mapped comparator.

Parameters:
comp - the original comparator
mapping - the mapping
Method Detail

compare

public int compare(F o1,
                   F o2)
Specified by:
compare in interface Comparator<F>

common-util

Copyright © 2005-2007 Tomas Teubner. All Rights Reserved.