public enum FamilyMemberTypes {

    CHILD("CHILD", "Child"),
    FTH("FTH", "Father"),
    MTH("MTH", "Mother"),
    MGRMTH("MGRMTH", "Maternal Grandmother"),
    PGRMTH("PGRMTH", "Paternal Grandmother"),
    MGRFTH("MGRFTH", "Maternal Grandfather"),
    PGRFTH("PGRFTH", "Paternal Grandfather");

    private final String key;
    private final String value;

    FamilyMemberTypes(String key, String value) {
        this.key = key;
        this.value = value;

    public String getKey() {
        return key;

    public String getValue() {
        return value;

    //Lookup table
    private static final Map<String, String> lookup = new HashMap<>();

    //Populate the lookup table on loading time
    static {
        for (FamilyMemberTypes familyMemberTypes : FamilyMemberTypes.values()) {
            lookup.put(familyMemberTypes.getKey(), familyMemberTypes.getValue());

    //This method can be used for reverse lookup purpose
    public static String getValue(String key) {
        return lookup.get(key);

downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter