compare


Description:

public int compare (Comparable? other)

Compares the two objects, returning -1 if this is "less than" other by some metric, 0 if they're equal, or 1 if this is "greater than" other.

null values are handled gracefully, with 0 returned if both this and other are null, -1 if this is null and 1 if other is null.

The other object must be of the same type as this, or of a type derived from this's type.

Parameters:

this

a Comparable, or null

other

another Comparable of the same type, or null

Returns:

true on success, false otherwise