diff --git a/timeago-parser/src/main/java/org/schabi/newpipe/extractor/timeago/PatternsHolder.java b/timeago-parser/src/main/java/org/schabi/newpipe/extractor/timeago/PatternsHolder.java index f7dc99630..1e87f202d 100644 --- a/timeago-parser/src/main/java/org/schabi/newpipe/extractor/timeago/PatternsHolder.java +++ b/timeago-parser/src/main/java/org/schabi/newpipe/extractor/timeago/PatternsHolder.java @@ -1,12 +1,13 @@ package org.schabi.newpipe.extractor.timeago; +import static java.util.Arrays.asList; + import java.time.temporal.ChronoUnit; import java.util.Collection; +import java.util.EnumMap; import java.util.LinkedHashMap; import java.util.Map; -import static java.util.Arrays.asList; - public abstract class PatternsHolder { private final String wordSeparator; private final Collection seconds; @@ -17,7 +18,8 @@ public abstract class PatternsHolder { private final Collection months; private final Collection years; - private final Map> specialCases = new LinkedHashMap<>(); + private final Map> specialCases = + new EnumMap<>(ChronoUnit.class); protected PatternsHolder(String wordSeparator, Collection seconds, Collection minutes, Collection hours, Collection days, @@ -81,7 +83,7 @@ public abstract class PatternsHolder { } public Map> asMap() { - final Map> returnMap = new LinkedHashMap<>(); + final Map> returnMap = new EnumMap<>(ChronoUnit.class); returnMap.put(ChronoUnit.SECONDS, seconds()); returnMap.put(ChronoUnit.MINUTES, minutes()); returnMap.put(ChronoUnit.HOURS, hours());