8361717: Refactor Collections.emptyList() in Locale related classes

Reviewed-by: bpb, jlu, liach, cstein
This commit is contained in:
Naoto Sato 2025-07-10 16:08:05 +00:00
parent cbc7090b91
commit f5afbbd32a
2 changed files with 3 additions and 5 deletions

View File

@ -51,7 +51,7 @@ public record LanguageTag(String language, String script, String region, String
public static final String UNDETERMINED = "und";
public static final String PRIVUSE_VARIANT_PREFIX = "lvariant";
private static final String EMPTY_SUBTAG = "";
private static final List<String> EMPTY_SUBTAGS = Collections.emptyList();
private static final List<String> EMPTY_SUBTAGS = List.of();
// Map contains legacy language tags and its preferred mappings from
// http://www.ietf.org/rfc/rfc5646.txt

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,6 @@ package sun.util.locale.provider;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.IllformedLocaleException;
import java.util.List;
@ -388,8 +387,7 @@ public final class LocaleServiceProviderPool {
* A dummy locale service provider list that indicates there is no
* provider available
*/
private static final List<LocaleServiceProvider> NULL_LIST =
Collections.emptyList();
private static final List<LocaleServiceProvider> NULL_LIST = List.of();
/**
* An interface to get a localized object for each locale sensitive