TemporalAmount.addTo

Adds to the specified temporal object. !(p) Adds the amount to the specified temporal object using the logic encapsulated _in the implementing class. !(p) There are two equivalent ways of using this method. The first is to invoke this method directly. The second is to use {@link Temporal#plus(TemporalAmount)}: !(pre) // These two lines are equivalent, but the second approach is recommended dateTime = amount.addTo(dateTime); dateTime = dateTime.plus(adder); </pre> It is recommended to use the second approach, {@code plus(TemporalAmount)}, as it is a lot clearer to read _in code.

@implSpec The implementation must take the input object and add to it. The implementation defines the logic of the addition and is responsible for documenting that logic. It may use any method on {@code Temporal} to query the temporal object and perform the addition. The returned object must have the same observable type as the input object !(p) The input object must not be altered. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable temporal objects. !(p) The input temporal object may be _in a calendar system other than ISO. Implementations may choose to document compatibility with other calendar systems, or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. !(p) This method may be called from multiple threads _in parallel. It must be thread-safe when invoked.

@param temporal the temporal object to add the amount to, not null @return an object of the same observable type with the addition made, not null @throws DateTimeException if unable to add @throws ArithmeticException if numeric overflow occurs

interface TemporalAmount
addTo

Meta