Microsoft SDK for Java

compare

This method of the Sort Class is called when the sorting engine must compare two elements. Subclasses override this method in a container-specific manner.

Syntax

protected int compare(int p, int q);

Return Value

Returns an integer describing the relationship of the elements.

If Sort returns less than a 0, place element p before element q in the sort.

If Sort returns greater than 0, place element p after element q.

If Sort returns 0, elements p and q are equivelent.

Parameters

p The index of the first operand of the comparison.
q The index of the second operand of the comparison.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.