forked from plusone/plusone-commons
不允许 id 重复。
parent
87c9d15751
commit
292e982ab2
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue