harpoon.Util
Class ListComparator
java.lang.Object
|
+--harpoon.Util.ListComparator
- All Implemented Interfaces:
- Comparator
- public class ListComparator
- extends Object
- implements Comparator
A ListComparator
compares two lists element-by-element.
- Version:
- $Id: ListComparator.java,v 1.2 2002/02/25 21:08:45 cananian Exp $
- Author:
- C. Scott Ananian <cananian@alumni.princeton.edu>
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ListComparator
public ListComparator()
- Creates a
ListComparator
which compares
elements first-to-last. All elements of the list must
implement java.lang.Comparable
.
ListComparator
public ListComparator(boolean cmpForwards,
Comparator elementComparator)
- Creates a
ListComparator
. If cmpForwards
is true
, compares elements first-to-last, otherwise
compares them last-to-first. If elementComparator
is null
, then all elements of the list must
implement java.lang.Comparable
and the
ListComparator
uses their natural ordering. Otherwise,
it uses the supplied Comparator
to compare elements.
compare
public int compare(Object o1,
Object o2)
- Specified by:
compare
in interface Comparator