harpoon.Util
Class ListComparator<T>

java.lang.Object
  extended by harpoon.Util.ListComparator<T>
All Implemented Interfaces:
Comparator<List<T>>

public class ListComparator<T>
extends Object
implements Comparator<List<T>>

A ListComparator compares two lists element-by-element.

Version:
$Id: ListComparator.java,v 1.3 2004/02/08 01:56:15 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Constructor Summary
ListComparator()
          Creates a ListComparator which compares elements first-to-last.
ListComparator(boolean cmpForwards, Comparator<? super T> elementComparator)
          Creates a ListComparator.
 
Method Summary
 int compare(List<T> l1, List<T> l2)
           
 
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

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<? super T> 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.

Method Detail

compare

public int compare(List<T> l1,
                   List<T> l2)
Specified by:
compare in interface Comparator<List<T>>