Temporal (Groovy JDK enhancements)

Package: java.time.temporal

## Interface Temporal

- - ### Methods Summary

    Methods
    Return type | Name and parameters
    --- | ---
    `void` | `downto(Temporal to, Closure closure)` Iterates from this to the `to` Temporal, inclusive, decrementing by one unit each iteration, calling the closure once per iteration.
    `void` | `downto(Temporal to, TemporalUnit unit, Closure closure)` Iterates from this to the `to` Temporal, inclusive, decrementing by one `unit` each iteration, calling the closure once per iteration.
    `TemporalAmount` | `rightShift(Temporal other)` Returns a Duration or Period between this (inclusive) and the `other` Temporal (exclusive).
    `void` | `upto(Temporal to, Closure closure)` Iterates from this to the `to` Temporal, inclusive, incrementing by one unit each iteration, calling the closure once per iteration.
    `void` | `upto(Temporal to, TemporalUnit unit, Closure closure)` Iterates from this to the `to` Temporal, inclusive, incrementing by one `unit` each iteration, calling the closure once per iteration.

  - #### Methods inherited from interface java.time.temporal.TemporalAccessor

    `getAt`

- - ### Methods Detail

    - #### public void downto(Temporal to, Closure closure)

      Iterates from this to the `to` Temporal, inclusive, decrementing by one unit each iteration, calling the closure once per iteration. The closure may accept a single Temporal argument.

      The particular unit decremented by depends on the specific sub-type of Temporal. Most sub-types use a unit of ChronoUnit#SECONDS except for

      - ChronoLocalDate and its sub-types use ChronoUnit#DAYS.
      - YearMonth uses ChronoUnit#MONTHS.
      - Year uses ChronoUnit#YEARS.
      Parameters:
        `to` - the ending Temporal
        `closure` - the zero or one-argument closure to call
      Since:
        2.5.0

    - #### public void downto(Temporal to, TemporalUnit unit, Closure closure)

      Iterates from this to the `to` Temporal, inclusive, decrementing by one `unit` each iteration, calling the closure once per iteration. The closure may accept a single Temporal argument.

      If the unit is too large to iterate to the second Temporal exactly, such as iterating from two LocalDateTimes that are seconds apart using ChronoUnit#DAYS as the unit, the iteration will cease as soon as the current value of the iteration is earlier than the second Temporal argument. The closure will not be called with any value earlier than the `to` value.

      Parameters:
        `to` - the ending Temporal
        `unit` - the TemporalUnit to increment by
        `closure` - the zero or one-argument closure to call
      Since:
        2.5.0

    - #### public TemporalAmount rightShift(Temporal other)

      Returns a Duration or Period between this (inclusive) and the `other` Temporal (exclusive).

      A Period will be returned for types Year, YearMonth, and ChronoLocalDate; otherwise, a Duration will be returned.

      Note: if the Temporal is a ChronoLocalDate but not a LocalDate, a general ChronoPeriod will be returned as per the return type of the method ChronoLocalDate#until(ChronoLocalDate) .

      Parameters:
        `other` - another Temporal of the same type
      Returns:
        an TemporalAmount between the two Temporals
      Since:
        2.5.0

    - #### public void upto(Temporal to, Closure closure)

      Iterates from this to the `to` Temporal, inclusive, incrementing by one unit each iteration, calling the closure once per iteration. The closure may accept a single Temporal argument.

      The particular unit incremented by depends on the specific sub-type of Temporal. Most sub-types use a unit of ChronoUnit#SECONDS except for

      - ChronoLocalDate and its sub-types use ChronoUnit#DAYS.
      - YearMonth uses ChronoUnit#MONTHS.
      - Year uses ChronoUnit#YEARS.
      Parameters:
        `to` - the ending Temporal
        `closure` - the zero or one-argument closure to call
      Since:
        2.5.0

    - #### public void upto(Temporal to, TemporalUnit unit, Closure closure)

      Iterates from this to the `to` Temporal, inclusive, incrementing by one `unit` each iteration, calling the closure once per iteration. The closure may accept a single Temporal argument.

      If the unit is too large to iterate to the second Temporal exactly, such as iterating from two LocalDateTimes that are seconds apart using ChronoUnit#DAYS as the unit, the iteration will cease as soon as the current value of the iteration is later than the second Temporal argument. The closure will not be called with any value later than the `to` value.

      Parameters:
        `to` - the ending Temporal
        `unit` - the TemporalUnit to increment by
        `closure` - the zero or one-argument closure to call
      Since:
        2.5.0