Code example for Map

Methods: containsKey, get

0
	 
	public static Locale getLocale(String localeCode)
    { 
		if (localeCode == null) { return null; }
		String code = localeCode.replace('-', '_');
    	if (locales.containsKey(code)) {
    		return locales.get(code);
    	} 
    	 
    	String language = "", country = "", variant = "";
    	if (code.startsWith("__")) {
    		// This is weird, just a variant.  Whatever, give it a shot. 
    		StringTokenizer tokens = new StringTokenizer(code, "__");
    		if (tokens.hasMoreElements()) {
    			variant = tokens.nextToken();
    		} 
    	} else if (code.startsWith("_")) {
    		// No language specified, but country specified and maybe variant. 
    		StringTokenizer tokens = new StringTokenizer(code, "_");
        	if (tokens.hasMoreElements()) {
        		country = tokens.nextToken();