Compares two values and returns a number having the same relative value to zero.
Compare will return a number
Object.compare
delegates to compare
methods of objects when they are
available, and returns 0 if neither the left or right object support
comparison.
When comparing numbers, compare
returns the difference between the left and
right, which expresses both the direction and magnitude of the relative values.
If the magnitude of the difference is not meaningful, compare should return
only Infinity, -Infinity, or 0, but there is a long established precedent
from C of returning -1 and 1 instead.
Note that comparison is not sufficient to distinguish equality, since 0 can mean that the values are incomparable.
The optional second argument is an alternate comparator to use on the content of
the left collection, and defaults to Object.compare
.
Returns whether this collection is equivalent to the given collection.
Consistently returns the same string for the same object.