Interface Comparator

public interface Comparator

An interface for comparing two objects.

Note: This interface is compatible with the Comparator interface that is in Java 2. Since we are still using Java 1.1 I will just make this interface. When we move to Java 2, this interface can easily be eliminated.

Method Summary
 int compare(java.lang.Object a, java.lang.Object b)
          Compare objects a and b.
 boolean equals(java.lang.Object a, java.lang.Object b)
          Compare two objects for equality.

Method Detail


public int compare(java.lang.Object a,
                   java.lang.Object b)
Compare objects a and b. Return value will be negative, 0, or positive if a < b, a == b, or a > b respectively.

negative, 0, or positive if ab respectively.


public boolean equals(java.lang.Object a,
                      java.lang.Object b)
Compare two objects for equality.

the same value as (compare(a,b) == 0)

Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.