org.mmbase.util
Class ChainedComparator<E>

java.lang.Object
  extended by org.mmbase.util.ChainedComparator<E>
All Implemented Interfaces:
Comparator<E>

public class ChainedComparator<E>
extends Object
implements Comparator<E>

Straight forward utility to chain several comparators into a new one. This 'chained comparator falls back to the next comparator if two object compare equally large (Comparator.compare(T, T) returns 0).

Since:
MMBase-1.9.2
Version:
$Id: ChainedList.java 34900 2009-05-01 16:29:42Z michiel $
Author:
Michiel Meeuwissen

Constructor Summary
ChainedComparator(Comparator<E>... cmps)
           
 
Method Summary
 ChainedComparator<E> addComparator(Comparator<E> c)
           
 int compare(E e1, E e2)
           
 boolean equals(Object o)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainedComparator

public ChainedComparator(Comparator<E>... cmps)
Method Detail

addComparator

public ChainedComparator<E> addComparator(Comparator<E> c)

compare

public int compare(E e1,
                   E e2)
Specified by:
compare in interface Comparator<E>

equals

public boolean equals(Object o)
Specified by:
equals in interface Comparator<E>
Overrides:
equals in class Object


MMBase 2.0-SNAPSHOT - null