102 * the local time.
103 * <p>
104 * For example, consider adding a period of one day and a duration of one day to
105 * 18:00 on the evening before a daylight savings gap. The {@code Period} will add
106 * the conceptual day and result in a {@code ZonedDateTime} at 18:00 the following day.
107 * By contrast, the {@code Duration} will add exactly 24 hours, resulting in a
108 * {@code ZonedDateTime} at 19:00 the following day (assuming a one hour DST gap).
109 * <p>
110 * The supported units of a period are {@link ChronoUnit#YEARS YEARS},
111 * {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}.
112 * All three fields are always present, but may be set to zero.
113 * <p>
114 * The ISO-8601 calendar system is the modern civil calendar system used today
115 * in most of the world. It is equivalent to the proleptic Gregorian calendar
116 * system, in which today's rules for leap years are applied for all time.
117 * <p>
118 * The period is modeled as a directed amount of time, meaning that individual parts of the
119 * period may be negative.
120 *
121 * <p>
122 * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
123 * class; use of identity-sensitive operations (including reference equality
124 * ({@code ==}), identity hash code, or synchronization) on instances of
125 * {@code Period} may have unpredictable results and should be avoided.
126 * The {@code equals} method should be used for comparisons.
127 *
128 * @implSpec
129 * This class is immutable and thread-safe.
130 *
131 * @since 1.8
132 */
133 public final class Period
134 implements ChronoPeriod, Serializable {
135
136 /**
137 * A constant for a period of zero.
138 */
139 public static final Period ZERO = new Period(0, 0, 0);
140 /**
141 * Serialization version.
142 */
|
102 * the local time.
103 * <p>
104 * For example, consider adding a period of one day and a duration of one day to
105 * 18:00 on the evening before a daylight savings gap. The {@code Period} will add
106 * the conceptual day and result in a {@code ZonedDateTime} at 18:00 the following day.
107 * By contrast, the {@code Duration} will add exactly 24 hours, resulting in a
108 * {@code ZonedDateTime} at 19:00 the following day (assuming a one hour DST gap).
109 * <p>
110 * The supported units of a period are {@link ChronoUnit#YEARS YEARS},
111 * {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}.
112 * All three fields are always present, but may be set to zero.
113 * <p>
114 * The ISO-8601 calendar system is the modern civil calendar system used today
115 * in most of the world. It is equivalent to the proleptic Gregorian calendar
116 * system, in which today's rules for leap years are applied for all time.
117 * <p>
118 * The period is modeled as a directed amount of time, meaning that individual parts of the
119 * period may be negative.
120 *
121 * <p>
122 * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
123 * class; use of identity-sensitive operations (including reference equality
124 * ({@code ==}), identity hash code, or synchronization) on instances of
125 * {@code Period} may have unpredictable results and should be avoided.
126 * The {@code equals} method should be used for comparisons.
127 *
128 * @implSpec
129 * This class is immutable and thread-safe.
130 *
131 * @since 1.8
132 */
133 public final class Period
134 implements ChronoPeriod, Serializable {
135
136 /**
137 * A constant for a period of zero.
138 */
139 public static final Period ZERO = new Period(0, 0, 0);
140 /**
141 * Serialization version.
142 */
|