Year.plus

Returns a copy of this year with the specified amount added. !(p) This returns a {@code Year}, based on this one, with the amount _in terms of the unit added. If it is not possible to add the amount, because the unit is not supported or for some other reason, an exception is thrown. !(p) If the field is a {@link ChronoUnit} then the addition is implemented here. The supported fields behave as follows: !(ul) !(li){@code YEARS} - Returns a {@code Year} with the specified number of years added. This is equivalent to {@link #plusYears(long)}. !(li){@code DECADES} - Returns a {@code Year} with the specified number of decades added. This is equivalent to calling {@link #plusYears(long)} with the amount multiplied by 10. !(li){@code CENTURIES} - Returns a {@code Year} with the specified number of centuries added. This is equivalent to calling {@link #plusYears(long)} with the amount multiplied by 100. !(li){@code MILLENNIA} - Returns a {@code Year} with the specified number of millennia added. This is equivalent to calling {@link #plusYears(long)} with the amount multiplied by 1,000. !(li){@code ERAS} - Returns a {@code Year} with the specified number of eras added. Only two eras are supported so the amount must be one, zero or minus one. If the amount is non-zero then the year is changed such that the year-of-era is unchanged. </ul> !(p) All other {@code ChronoUnit} instances will throw an {@code UnsupportedTemporalTypeException}. !(p) If the field is not a {@code ChronoUnit}, then the result of this method is obtained by invoking {@code TemporalUnit.addTo(Temporal, long)} passing {@code this} as the argument. In this case, the unit determines whether and how to perform the addition. !(p) This instance is immutable and unaffected by this method call.

@param amountToAdd the amount of the unit to add to the result, may be negative @param unit the unit of the amount to add, not null @return a {@code Year} based on this year with the specified amount added, not null @throws DateTimeException if the addition cannot be made @throws UnsupportedTemporalTypeException if the unit is not supported @throws ArithmeticException if numeric overflow occurs

  1. Year plus(TemporalAmount amountToAdd)
  2. Year plus(long amountToAdd, TemporalUnit unit)
    class Year
    override
    plus

Meta