Converted Map to EnumMap

When all the keys of a Map are values from the same enum, the Map can be
replaced with an EnumMap, which can be much more efficient than other
sets because the underlying data structure is a simple array.
This commit is contained in:
Tastybento 2018-02-07 19:12:23 -08:00
parent 7b55ca70b2
commit 7e7b259531

View File

@ -2,6 +2,7 @@ package us.tastybento.bskyblock;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@ -132,7 +133,9 @@ public class Settings implements ISettings<Settings> {
private boolean endIslands = true;
// Entities
private Map<EntityType, Integer> entityLimits = new HashMap<>();
@ConfigEntry(path = "island.limits.entities")
private Map<EntityType, Integer> entityLimits = new EnumMap<>(EntityType.class);
@ConfigEntry(path = "island.limits.tile-entities")
private Map<String, Integer> tileEntityLimits = new HashMap<>();
// ---------------------------------------------