This commit is contained in:
2023-04-29 15:09:53 +08:00
3 changed files with 10 additions and 22 deletions

View File

@@ -74,12 +74,12 @@ public abstract class Enumeration<T extends Enumeration<T>> implements Comparabl
@SafeVarargs
public ValueSet(T... values) {
Map<Integer, T> valueMap = new HashMap<>(values.length);
Map<Integer, T> temp = new HashMap<>(values.length);
for (T value : values) {
Assert.notNull(value, "Value must not be null.");
valueMap.put(value.getId(), value);
temp.put(value.getId(), value);
}
this.valueMap = Collections.unmodifiableMap(valueMap);
this.valueMap = Collections.unmodifiableMap(temp);
}
public T get(int id) {