| Code with Finding: |
class LocaleUtils {
/**
* <p>Obtains an unmodifiable set of installed locales.</p>
*
* <p>This method is a wrapper around {@link Locale#getAvailableLocales()}.
* It is more efficient, as the JDK method must create a new array each
* time it is called.</p>
*
* @return the unmodifiable set of available locales
*/
public static Set availableLocaleSet() {
Set set = cAvailableLocaleSet;
if (set == null) {
set = new HashSet(availableLocaleList());
set = Collections.unmodifiableSet(set);
cAvailableLocaleSet = set;
}
return set;
}
}
|