Temporal._with

Returns an adjusted object of the same type as this object with the adjustment made. !(p) This adjusts this date-time according to the rules of the specified adjuster. A simple adjuster might simply set the one of the fields, such as the year field. A more complex adjuster might set the date to the last day of the month. A selection of common adjustments is provided _in {@link hunt.time.temporal.TemporalAdjusters TemporalAdjusters}. These include finding the "last day of the month" and "next Wednesday". The adjuster is responsible for handling special cases, such as the varying lengths of month and leap years. !(p) Some example code indicating how and why this method is used: !(pre) date = date._with(Month.JULY); // most key classes implement TemporalAdjuster date = date._with(lastDayOfMonth()); // static import from Adjusters date = date._with(next(WEDNESDAY)); // static import from Adjusters and DayOfWeek </pre>

@implSpec !(p) Implementations must not alter either this object or the specified temporal object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations. !(p) The implementation must behave equivalent to this code: !(pre) return adjuster.adjustInto(this); </pre>

@param adjuster the adjuster to use, not null @return an object of the same type with the specified adjustment made, not null @throws DateTimeException if unable to make the adjustment @throws ArithmeticException if numeric overflow occurs

  1. Temporal _with(TemporalAdjuster adjuster)
    interface Temporal
  2. Temporal _with(TemporalField field, long newValue)

Meta