<i18n dev> RFR: 8282319: java.util.Locale method to stream available Locales

Naoto Sato naoto at openjdk.org
Thu Feb 23 20:02:14 UTC 2023


On Fri, 27 Jan 2023 21:48:26 GMT, Justin Lu <jlu at openjdk.org> wrote:

> This PR adds a new method to java.util.Locale which returns Stream<Locale>
> 
> The contents of the Stream are composed of the same underlying elements as Locale.getAvailableLocales().
> 
> This method allows streaming of the Locale array without creating a defensive copy.

Looks good. Some minor comments follow.

src/java.base/share/classes/java/util/Locale.java line 1223:

> 1221:      * {@code Locale} instance equal to {@link Locale#ROOT Locale.ROOT} and
> 1222:      * a {@code Locale} instance equal to {@link Locale#US Locale.US}.
> 1223:      * @implNote Unlike {@code getAvailableLocales()}, this method does

I'd insert a blank line between the method description paragraphs and the following javadoc tags.

src/java.base/share/classes/sun/util/locale/provider/LocaleServiceProviderPool.java line 155:

> 153:      * that are provided by each provider, including the JRE.
> 154:      *
> 155:      * @return a stream of the available locales for all provider classes

Could use {@return } as well.

test/jdk/java/util/Locale/StreamAvailableLocales.java line 26:

> 24:  * @test
> 25:  * @summary Test the implementation
> 26:  * of Locale.streamAvailableLocales()

`availableLocales()`? There are other locations using the name too.

-------------

PR: https://git.openjdk.org/jdk/pull/12269


More information about the i18n-dev mailing list