Java Linear time
```\n    public String entityParser(String text) {\n        Map map = new HashMap<>();\n        map.put(""", "\"");\n        map.put("'", "\'");\n        map.pu
```\n    public String entityParser(String text) {\n        Map<String, String> map = new HashMap<>();\n        map.put("&quot;", "\\"");\n        map.put("&apos;", "\'");\n        map.put("&amp;", "&");\n        map.put("&gt;", ">");\n        map.put("&lt;", "<");\n        map.put("&frasl;", "/");\n\n        int start = -1;\n        boolean keepAdding = true;\n        StringBuilder sb = new StringBuilder();\n        for (int i = 0; i < text.length(); i++) {\n            if (text.charAt(i) == \'&\') {\n                if (start != -1) {\n                    sb.append(text, start, i);\n                }\n                start = i;\n                keepAdding = false;\n            }\n            if (keepAdding) {\n                sb.append(text.charAt(i));\n            }\n            if (text.charAt(i) == \';\' && start != -1) {\n                if (map.containsKey(text.substring(start, i + 1))) {\n                    sb.append(map.get(text.substring(start, i + 1)));\n                    keepAdding = true;\n                    start = -1;\n                }\n            }\n        }\n        if (!keepAdding) {\n            sb.append(text.substring(start));\n        }\n        return sb.toString();\n    }\n
[]