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

java.time.Duration missing isPositive method

    XMLWordPrintable

Details

    • CSR
    • Status: Closed
    • P4
    • Resolution: Approved
    • 18
    • core-libs
    • None
    • minimal
    • This is a new method on a final class, so the compatibility risk is minimal.
    • Java API
    • 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

              naoto Naoto Sato
              rriggs Roger Riggs
              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: