org.databene.commons.comparator
Class ComparatorChain<E>
java.lang.Object
org.databene.commons.comparator.ComparatorChain<E>
- All Implemented Interfaces:
- java.util.Comparator<E>
public class ComparatorChain<E>
- extends java.lang.Object
- implements java.util.Comparator<E>
Delegates comparation to a chain of comparators.
They are evaluated consecutively and the first result that is not zero is returned.
If all used Comparators return zero, zero is returned as the comparation result.
You can use this, e.g. for ordering objects by attributes of different priority,
e.g. country, city.
Created: 22.05.2007 18:16:15
- Author:
- Volker Bergmann
| 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 |
ComparatorChain
public ComparatorChain(java.util.Comparator<E>... comparators)
compare
public int compare(E e1,
E e2)
- Specified by:
compare in interface java.util.Comparator<E>
Copyright © 2010. All Rights Reserved.