Java tutorial
//package com.java2s; import java.util.*; public class Main { public static int getIdGenerator(String description) { return getMap().get(description); } public static HashMap<String, Integer> getMap() { HashMap<String, Integer> idDescriptionMap = new HashMap<String, Integer>(); idDescriptionMap.put("Play", 1); idDescriptionMap.put("Exit", 2); idDescriptionMap.put("Replay", 3); idDescriptionMap.put("Main Menu", 4); return idDescriptionMap; } }