Easy java. Say no to too many if/else
\nclass Solution {\n    Map<String, String> dict = new HashMap<>();\n    {\n        dict.put("&quot;", "\\"");\n        dict.put("&apos;", "\'");\n        dict.
```\nclass Solution {\n    Map<String, String> dict = new HashMap<>();\n    {\n        dict.put("&quot;", "\\"");\n        dict.put("&apos;", "\'");\n        dict.put("&amp;", "&");\n        dict.put("&gt;", ">");\n        dict.put("&lt;", "<");\n        dict.put("&frasl;", "/");\n    }\n       \n    public String entityParser(String text) {\n        StringBuilder sb = new StringBuilder();\n        Stack<Integer> stack = new Stack<>();\n        for (int i = 0; i < text.length(); i++) {\n            char cur = text.charAt(i);\n            sb.append(cur);\n            if (cur == \'&\') {\n                stack.push(sb.length() - 1);\n            } else if (cur == \';\' && !stack.isEmpty()) {\n                int start = stack.pop();\n                String key = sb.substring(start);\n                if (dict.containsKey(key)) {\n                    sb = sb.delete(start, sb.length()).append(dict.get(key));\n                }\n            }\n        }\n        return sb.toString();\n    }\n}\n```
[]