Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6366835

(coll) Clarify Comparable.compareTo spec

XMLWordPrintable

    • b67
    • generic
    • generic

      Josh Bloch writes:

      The Comparable.compareTo doc says:

        In the foregoing description, the notation sgn(expression)
      designates the mathematical signum function, which is defined to
      return one of -1, 0, or 1 according to whether the value of expression
       is negative, zero or positive. The implementor must ensure
      sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This
      implies that x.compareTo(y) must throw an exception iff y.compareTo(x)
      throws an exception.)

      It looks like the first sentence of this paragraph should be moved to the end.

            martin Martin Buchholz
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: