Here's JBoss JSTL implementation for the EscapeXML tag
public class EscapeXML {
private static final String[] ESCAPES;
static {
int size = '>' + 1; // '>' is the largest escaped value
ESCAPES = new String[size];
ESCAPES['<'] = "<";
ESCAPES['>'] = ">";
ESCAPES['&'] = "&";
ESCAPES['\''] = "'";
ESCAPES['"'] = """;
}
//omitted
}
Why is ESCAPES a 61 elements array? What are the implication of using a Map<Character,String> instead?