<i18n dev> java.util.Locale changes

Christian Beikov christian.beikov at gmail.com
Wed Aug 28 06:34:57 PDT 2013


Hey,

I haven't digged so deep where java.util.List is used but thanks for the 
pointer.
I have no problem with the usage of java.util.List as stated before. I 
am just thinking that, if someone for example uses a java.util.Set to 
represent the priorities, it would be necessary to construct a List to 
wrap the elements. The additional value is that in both cases, when 
passing a List or a Set to the methods, no additional overhead is necessary.

Mit freundlichen Grüßen,
------------------------------------------------------------------------
*Christian Beikov*
Am 28.08.2013 15:25, schrieb Masayoshi Okutsu:
> (adding core-libs-dev)
>
> Hi Christian,
>
> RFC 4647 defines The Language Priority List [1]. The use of 
> java.util.List would be a natural fit, which is the reason why List is 
> used. But use of Iterable does work (as API design). The parameter 
> name `priorityIterable' sounds a bit odd, though.
>
> Does use of Iterable add much value to the API? (Please note that List 
> is also used in Locale.LanguageRange.)
>
> Thanks,
> Masayoshi
>
> [1] http://tools.ietf.org/html/rfc4647#section-2.3
>
> On 2013/08/28 18:31, Christian Beikov wrote:
>> 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.
>>
>



More information about the i18n-dev mailing list