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

java.time.Duration missing isPositive method

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 18
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      This is a new method on a final class, so the compatibility risk is minimal.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Provide isPositive() method in java.time.Duration.

      Problem

      There are isNegative() and isZero() methods in the class, but missing isPositive().

      Solution

      Add isPositive() method for completeness.

      Specification

      Add the following isPositive() method in java.time.Duration class.

      /**
       * Checks if this duration is positive, excluding zero.
       * <p>
       * A {@code Duration} represents a directed distance between two points on
       * the time-line and can therefore be positive, zero or negative.
       * This method checks whether the length is greater than zero.
       *
       * @return true if this duration has a total length greater than zero
       * @since 18
       */
      public boolean isPositive()

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              naoto Naoto Sato
              Reporter:
              rriggs Roger Riggs
              Reviewed By:
              Brian Burkhalter, Iris Clark, Joe Wang, Lance Andersen, Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: