Skip to content

Commit f5afbbd

Browse files
committed
8361717: Refactor Collections.emptyList() in Locale related classes
Reviewed-by: bpb, jlu, liach, cstein
1 parent cbc7090 commit f5afbbd

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/java.base/share/classes/sun/util/locale/LanguageTag.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public record LanguageTag(String language, String script, String region, String
5151
public static final String UNDETERMINED = "und";
5252
public static final String PRIVUSE_VARIANT_PREFIX = "lvariant";
5353
private static final String EMPTY_SUBTAG = "";
54-
private static final List<String> EMPTY_SUBTAGS = Collections.emptyList();
54+
private static final List<String> EMPTY_SUBTAGS = List.of();
5555

5656
// Map contains legacy language tags and its preferred mappings from
5757
// http://www.ietf.org/rfc/rfc5646.txt

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,6 @@
2727

2828
import java.util.ArrayList;
2929
import java.util.Arrays;
30-
import java.util.Collections;
3130
import java.util.HashSet;
3231
import java.util.IllformedLocaleException;
3332
import java.util.List;
@@ -388,8 +387,7 @@ static Locale getLookupLocale(Locale locale) {
388387
* A dummy locale service provider list that indicates there is no
389388
* provider available
390389
*/
391-
private static final List<LocaleServiceProvider> NULL_LIST =
392-
Collections.emptyList();
390+
private static final List<LocaleServiceProvider> NULL_LIST = List.of();
393391

394392
/**
395393
* An interface to get a localized object for each locale sensitive

0 commit comments

Comments
 (0)