Tagged articles
3 articles
Page 1 of 1
macrozheng
macrozheng
Nov 2, 2023 · Fundamentals

When to Use List.of vs Arrays.asList in Java: Immutable vs Mutable Lists Explained

This article compares Java's List.of() and Arrays.asList() methods, detailing their immutable versus mutable characteristics, handling of nulls, size constraints, and underlying array behavior, and provides practical code examples and guidance on choosing the appropriate method for different programming scenarios.

Arrays.asListCollectionsImmutable List
0 likes · 7 min read
When to Use List.of vs Arrays.asList in Java: Immutable vs Mutable Lists Explained
Programmer DD
Programmer DD
May 21, 2022 · Backend Development

Simplify Immutable Collections in Java: From Collections.unmodifiable to List.of & Set.of

This article demonstrates how to create immutable collections in Java, comparing traditional approaches using Collections.unmodifiableSet/List with Java 8 Stream‑based methods and the concise Java 9 factory methods Set.of, List.of, and Map.of, and explains key differences between List.of and Arrays.asList.

Immutable CollectionsJava 9List.of
0 likes · 5 min read
Simplify Immutable Collections in Java: From Collections.unmodifiable to List.of & Set.of