List of usage examples for java.util Locale hashCode
@Override public int hashCode()
From source file:Main.java
public static void main(String[] args) { Locale locale = new Locale("en", "US", "WIN"); System.out.println("Locale:" + locale); // get a hash code and print it System.out.println("Language:" + locale.hashCode()); }
From source file:lucee.commons.i18n.FormatUtil.java
public static DateFormat[] getDateFormats(Locale locale, TimeZone tz, boolean lenient) { String id = "d-" + locale.hashCode() + "-" + tz.getID() + "-" + lenient; DateFormat[] df = formats.get(id); if (df == null) { List<DateFormat> list = new ArrayList<DateFormat>(); list.add(DateFormat.getDateInstance(DateFormat.FULL, locale)); list.add(DateFormat.getDateInstance(DateFormat.LONG, locale)); list.add(DateFormat.getDateInstance(DateFormat.MEDIUM, locale)); list.add(DateFormat.getDateInstance(DateFormat.SHORT, locale)); addCustom(list, locale, FORMAT_TYPE_DATE); df = list.toArray(new DateFormat[list.size()]); for (int i = 0; i < df.length; i++) { df[i].setLenient(lenient);/*w ww .ja va2 s . com*/ df[i].setTimeZone(tz); } formats.put(id, df); } return df; }
From source file:lucee.commons.i18n.FormatUtil.java
public static DateFormat[] getTimeFormats(Locale locale, TimeZone tz, boolean lenient) { String id = "t-" + locale.hashCode() + "-" + tz.getID() + "-" + lenient; DateFormat[] df = formats.get(id); if (df == null) { List<DateFormat> list = new ArrayList<DateFormat>(); list.add(DateFormat.getTimeInstance(DateFormat.FULL, locale)); list.add(DateFormat.getTimeInstance(DateFormat.LONG, locale)); list.add(DateFormat.getTimeInstance(DateFormat.MEDIUM, locale)); list.add(DateFormat.getTimeInstance(DateFormat.SHORT, locale)); add24(list, locale);//w w w.j av a 2 s .c om addCustom(list, locale, FORMAT_TYPE_TIME); df = list.toArray(new DateFormat[list.size()]); for (int i = 0; i < df.length; i++) { df[i].setLenient(lenient); df[i].setTimeZone(tz); } formats.put(id, df); } return df; }
From source file:lucee.commons.i18n.FormatUtil.java
public static DateFormat[] getDateTimeFormats(Locale locale, TimeZone tz, boolean lenient) { String id = "dt-" + locale.hashCode() + "-" + tz.getID() + "-" + lenient; DateFormat[] df = formats.get(id); if (df == null) { List<DateFormat> list = new ArrayList<DateFormat>(); list.add(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.LONG, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.MEDIUM, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.SHORT, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.FULL, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.FULL, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.FULL, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, locale)); list.add(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale)); add24(list, locale);//from w w w .ja v a 2s . c o m addCustom(list, locale, FORMAT_TYPE_DATE_TIME); df = list.toArray(new DateFormat[list.size()]); for (int i = 0; i < df.length; i++) { df[i].setLenient(lenient); df[i].setTimeZone(tz); } formats.put(id, df); } return df; }
From source file:org.echocat.locela.api.java.messages.MessageSupport.java
@Override public int hashCode() { final Locale locale = getLocale(); int result = locale != null ? locale.hashCode() : 0; result = 31 * result + getId().hashCode(); result = 31 * result + get().hashCode(); return result; }
From source file:org.spout.api.lang.CommonPluginDictionary.java
public LanguageDictionary getDictionary(Locale locale) { return languageDictionaries.get(locale.hashCode()); }
From source file:org.spout.api.lang.CommonPluginDictionary.java
public void setDictionary(Locale locale, LanguageDictionary dictionary) { languageDictionaries.put(locale.hashCode(), dictionary); }