Easiest way to get Enum in to Key Value pair.

Posted by vijay.shad on Stack Overflow See other posts from Stack Overflow or by vijay.shad
Published on 2010-03-08T12:11:19Z Indexed on 2010/03/08 12:21 UTC
Read the original article Hit count: 187

Filed under:
|

Hi,

I have defined my Enums like this.

public enum UserType {

    RESELLER("Reseller"),

    SERVICE_MANAGER("Manager"),

    HOST("Host");

    private String name;

    private UserType(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

}

What should be the easiest way to get a key-value pair form the enum values?

© Stack Overflow or respective owner

Related posts about java

Related posts about enum