Simple Java Solution using replaceAll O(n)
\n    public String entityParser(String text) {\n\t\t //Using linkedHashMap because the order of find and replace is important.\n        Map<String, String> ent
```\n    public String entityParser(String text) {\n\t\t //Using linkedHashMap because the order of find and replace is important.\n        Map<String, String> entityMap = new LinkedHashMap<>();\n        entityMap.put("&quot;", "\\"");\n        entityMap.put("&apos;", "\'");\n        entityMap.put("&gt;", ">");\n        entityMap.put("&lt;", "<");\n        entityMap.put("&frasl;", "/");\n        entityMap.put("&amp;", "&");\n        // & should be replaced at the end to avoid errors in cases like &amp;gt;\n\t\t \n        for(Map.Entry<String, String> entry: entityMap.entrySet()){\n            text = text.replaceAll(entry.getKey(), entry.getValue());\n        }\n        \n        return text;\n    }\n```
['Java']