<i18n dev> java.util.Locale changes

Christian Beikov christian.beikov at gmail.com
Wed Aug 28 02:25:56 PDT 2013


Hello there,

I have just seen the changes you want to apply to java.util.Locale in 
JDK 8 and was wondering why you are forcing the use of a java.util.List 
in the lookup and filter methods. The related methods of 
java.util.Locale are

public static Locale lookup(List<Locale.LanguageRange> priorityList, 
Collection<Locale> locales)
public static String lookupTag(List<Locale.LanguageRange> priorityList, 
Collection<String> tags)
public static List<String> filterTags(List<Locale.LanguageRange> 
priorityList, Collection<String> tags)
public static List<String> filterTags(List<Locale.LanguageRange> 
priorityList, Collection<String> tags, Locale.FilteringMode mode)
public static List<Locale> filter(List<Locale.LanguageRange> 
priorityList, Collection<Locale> locales)
public static List<Locale> filter(List<Locale.LanguageRange> 
priorityList, Collection<Locale> locales, Locale.FilteringMode mode)

which could be changed to

public static Locale lookup(Iterable<Locale.LanguageRange> 
priorityIterable, Collection<Locale> locales)
public static String lookupTag(Iterable<Locale.LanguageRange> 
priorityIterable, Collection<String> tags)
public static List<String> filterTags(Iterable<Locale.LanguageRange> 
priorityIterable, Collection<String> tags)
public static List<String> filterTags(Iterable<Locale.LanguageRange> 
priorityIterable, Collection<String> tags, Locale.FilteringMode mode)
public static List<Locale> filter(Iterable<Locale.LanguageRange> 
priorityIterable, Collection<Locale> locales)
public static List<Locale> filter(Iterable<Locale.LanguageRange> 
priorityIterable, Collection<Locale> locales, Locale.FilteringMode mode)

The use of java.util.Collection would also be ok.
One could also use a java.util.Set or something similar to represent the 
language ranges. I just wanted to provide that feedback if anyone cares. 
I am also ok with java.util.List but since you are only relying on the 
iteration order of the priorityList I was curious about the reason.

-- 

Mit freundlichen Grüßen,
------------------------------------------------------------------------
*Christian Beikov*


More information about the i18n-dev mailing list