I'm very new in Java and were wondering and didn't find anything about it.
Can you create enum tuple ?
public enum Status {OPEN : "1", CLOSED: "2", DELETED: "3"}
I will need to access both "OPEN" or "1"
You could always create a custom constructor for your enum..
public enum Status {
    OPEN("1"),
    CLOSED("2"),
    DELETED("3");
    private String code;
    public Status(String code) {
        this.code = code;
    }
    public String getCode() {
        return code;
    }
}
Then you can access with Status.OPEN.getCode(). This functions as an effective mapping between an enum type and a code value.
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