Build 1.0_r1(from source)

java.util
Interface Comparator<T>

All Known Implementing Classes:
ApplicationInfo.DisplayNameComparator, Charset.IgnoreCaseComparator, Collator, CookieIdentityComparator, CookiePathComparator, PackageItemInfo.DisplayNameComparator, ResolveInfo.DisplayNameComparator, RuleBasedCollator

public interface Comparator<T>

Comparator is used to compare two objects to determine their ordering in respect to each other.

Since:
1.2

Method Summary
 int compare(T object1, T object2)
          Compare the two objects to determine the relative ordering.
 boolean equals(Object object)
          Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 

Method Detail

compare

int compare(T object1,
            T object2)
Compare the two objects to determine the relative ordering.

Parameters:
object1 - an Object to compare
object2 - an Object to compare
Returns:
an int < 0="" if="" object1="" is="" less="" than="" object2,="" 0="" if="" they="" are="" equal,="" and=""> 0 if object1 is greater
Throws:
ClassCastException - when objects are not the correct type

equals

boolean equals(Object object)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

Overrides:
equals in class Object
Parameters:
object - Object the object to compare with this object.
Returns:
boolean true if the object is the same as this object false if it is different from this object.
See Also:
Object.hashCode()

Build 1.0_r1(from source)

Please submit a feedback, bug or feature