Package: java.time.temporal

## [Java] Interface Temporal

-     public interface Temporal

  GDK enhancements for Temporal.

  displayName:
    Temporal
  receiverFqcn:
    java.time.temporal.Temporal

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `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.
    `` | `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.
    `` | `public TemporalAmount` | `rightShift(Temporal other)` Returns a Duration or Period between this (inclusive) and the `other` Temporal (exclusive).
    `` | `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.
    `` | `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.

- - ### Method 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 subtype of Temporal. Most subtypes use a unit of ChronoUnit.SECONDS except for

      - ChronoLocalDate and its sub-types use ChronoUnit.DAYS.
      - YearMonth uses ChronoUnit.MONTHS.
      - Year uses ChronoUnit.YEARS.
      throws:
        GroovyRuntimeException if this value is earlier than `to`
      throws:
        GroovyRuntimeException if `to` is a different type than this
      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.

      throws:
        GroovyRuntimeException if this value is earlier than `to`
      throws:
        GroovyRuntimeException if `to` is a different type than this
      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 .

      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 subtype of Temporal. Most subtypes use a unit of ChronoUnit.SECONDS except for

      - ChronoLocalDate and its sub-types use ChronoUnit.DAYS.
      - YearMonth uses ChronoUnit.MONTHS.
      - Year uses ChronoUnit.YEARS.
      throws:
        GroovyRuntimeException if this value is later than `to`
      throws:
        GroovyRuntimeException if `to` is a different type than this
      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.

      throws:
        GroovyRuntimeException if this value is later than `to`
      throws:
        GroovyRuntimeException if `to` is a different type than this
      Parameters:
        `to` - the ending Temporal
        `unit` - the TemporalUnit to increment by
        `closure` - the zero or one-argument closure to call
      Since:
        2.5.0