RFR: 8361717: Refactor Collections.emptyList() in Locale related classes
Naoto Sato
naoto at openjdk.org
Thu Jul 10 16:10:54 UTC 2025
On Wed, 9 Jul 2025 18:39:40 GMT, Naoto Sato <naoto at openjdk.org> wrote:
> Replaced Collections.emptyList() with List.of() as part of refactoring. This was discussed in the context of investigating a CDS-related issue (https://bugs.openjdk.org/browse/JDK-8357281?focusedId=14796714&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14796714). Although the root cause was ultimately determined to be user error, modernizing the code by using List.of() is still a desirable improvement
Thanks for the reviews!
> except that `Collections.emptyList()` and `List.of()` unfortunately have different tolerance to calls `List.indexOf(null)` and `List.contains(null)`.
True in general, but as @liach mentioned, those singletons are internal use only so the difference is not relevant here.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26225#issuecomment-3058072009
More information about the core-libs-dev
mailing list