Java simple replace all
Only take care of "&" lastly;\n\npublic String entityParser(String text) {\n        if (text == null || text.length() == 0) {\n            return "";\n        }
Only take care of "&" lastly;\n```\npublic String entityParser(String text) {\n        if (text == null || text.length() == 0) {\n            return "";\n        }\n        Map<String, String> map = \n            Map.of("&quot;", "\\"", "&apos;", "\'", \n                   "&gt;", ">", \n                   "&lt;", "<", "&frasl;", "/");\n        for (String key : map.keySet()) {\n            text = text.replaceAll(key, map.get(key));\n        }\n        return text.replaceAll("&amp;", "&");  // "&" must be put in last;\n    }\n```
[]