Pacific-Design.com

    
Home Index

1. Java

2. HashMap Static

Java / HashMap Static /

Static HashMap

    static final Map<String, String> map;

    static {
        map = new HashMap<>();
        String[][] pairs = {
                {"01","AL"},
                {"02","AK"},
                {"04","AZ"},
                {"05","AR"},
                {"06","CA"},
                {"08","CO"},
                {"09","CT"},
                {"10","DE"},
                {"11","DC"},
                {"12","FL"},
                {"13","GA"}
        };
        for (String[] pair : pairs) {
            map.put(pair[0], pair[1]);
        }
    }