I defined an enum:
enum TestEnum {
test1,
test2,
}
and I want make an enum with index:
E buildEnum<E extends ?????????????????>(int index) {
try {
return E.values[index];
}
catch(e) {
return null;
}
}
I don't know the type of enum.
enum A { a0, a1, a2 }
A.values[index]
// e.g: A.values[0] == A.a0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With