mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-13 13:50:33 +05:30
Merge pull request #888 from Isira-Seneviratne/EnumMap
Use EnumMap in PatternsHolder.
This commit is contained in:
commit
2d50369c77
@ -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<String> seconds;
|
||||
@ -17,7 +18,8 @@ public abstract class PatternsHolder {
|
||||
private final Collection<String> months;
|
||||
private final Collection<String> years;
|
||||
|
||||
private final Map<ChronoUnit, Map<String, Integer>> specialCases = new LinkedHashMap<>();
|
||||
private final Map<ChronoUnit, Map<String, Integer>> specialCases =
|
||||
new EnumMap<>(ChronoUnit.class);
|
||||
|
||||
protected PatternsHolder(String wordSeparator, Collection<String> seconds, Collection<String> minutes,
|
||||
Collection<String> hours, Collection<String> days,
|
||||
@ -81,7 +83,7 @@ public abstract class PatternsHolder {
|
||||
}
|
||||
|
||||
public Map<ChronoUnit, Collection<String>> asMap() {
|
||||
final Map<ChronoUnit, Collection<String>> returnMap = new LinkedHashMap<>();
|
||||
final Map<ChronoUnit, Collection<String>> returnMap = new EnumMap<>(ChronoUnit.class);
|
||||
returnMap.put(ChronoUnit.SECONDS, seconds());
|
||||
returnMap.put(ChronoUnit.MINUTES, minutes());
|
||||
returnMap.put(ChronoUnit.HOURS, hours());
|
||||
|
Loading…
Reference in New Issue
Block a user