< prev index next >
src/java.base/share/classes/java/time/Duration.java
Print this page
@@ -86,12 +86,10 @@
import java.time.temporal.ChronoUnit;
import java.time.temporal.Temporal;
import java.time.temporal.TemporalAmount;
import java.time.temporal.TemporalUnit;
import java.time.temporal.UnsupportedTemporalTypeException;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -576,12 +574,11 @@
* Private class to delay initialization of this list until needed.
* The circular dependency between Duration and ChronoUnit prevents
* the simple initialization in Duration.
*/
private static class DurationUnits {
- static final List<TemporalUnit> UNITS =
- Collections.unmodifiableList(Arrays.<TemporalUnit>asList(SECONDS, NANOS));
+ static final List<TemporalUnit> UNITS = List.of(SECONDS, NANOS);
}
//-----------------------------------------------------------------------
/**
* Checks if this duration is zero length.
< prev index next >