189 B
189 B
Enum 转 int
C.ordinal()
int 转 Enum
只能遍历
for (MyEnum type : values()) {
if (type.getId() == id) {
return type;
}
}
return null;
C.ordinal()
只能遍历
for (MyEnum type : values()) {
if (type.getId() == id) {
return type;
}
}
return null;