不允许 id 重复。

dev
ZhouXY108 2024-04-07 16:44:48 +08:00
parent 87c9d15751
commit 292e982ab2
1 changed files with 1 additions and 1 deletions

View File

@ -89,7 +89,7 @@ public abstract class Enumeration<T extends Enumeration<T>> implements Comparabl
@StaticFactoryMethod(ValueSet.class) @StaticFactoryMethod(ValueSet.class)
public static <T extends Enumeration<T>> ValueSet<T> of(T... values) { public static <T extends Enumeration<T>> ValueSet<T> of(T... values) {
Map<Integer, T> temp = Arrays.stream(values) Map<Integer, T> temp = Arrays.stream(values)
.collect(Collectors.toMap(Enumeration::getId, Function.identity(), (a, b) -> b)); .collect(Collectors.toMap(Enumeration::getId, Function.identity()));
return new ValueSet<>(Collections.unmodifiableMap(temp)); return new ValueSet<>(Collections.unmodifiableMap(temp));
} }