Answer the question
In order to leave comments, you need to log in
How to access enam in numerical order?
there is this standard enam:
public enum DayOfWeek {
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY,
SUNDAY;
DayOfWeek() {
}
}
Answer the question
In order to leave comments, you need to log in
I would make another field with a getter:
public enum DayOfWeek {
MONDAY(1),
TUESDAY(2),
WEDNESDAY(3),
THURSDAY(4),
FRIDAY(5),
SATURDAY(6),
SUNDAY(7);
@Getter
private final int number;
DayOfWeek(int number) {
this.number = number;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question