From d4572566e24d7f3f0ab0690e2c5b7267a15cec40 Mon Sep 17 00:00:00 2001 From: YC-TAN <150326068+YC-TAN@users.noreply.github.com> Date: Thu, 16 Jul 2026 12:02:02 +1200 Subject: [PATCH] Update Map.ofEntries usage Looks like each entry should be wrapped in its own `Map.entry(K,V)` before being passed to `Map.ofEntries()` Change: From `Map temperatures = Map.ofEntries(Map.entry("Mon", 30, "Tue", 28, "Wed", 32));` To `Map temperatures2 = Map.ofEntries( Map.entry("Mon", 30), Map.entry("Tue", 28), Map.entry("Wed", 32) );` --- concepts/maps/about.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/concepts/maps/about.md b/concepts/maps/about.md index 86a820cf1..9590aefc0 100644 --- a/concepts/maps/about.md +++ b/concepts/maps/about.md @@ -145,7 +145,11 @@ Another common way to create maps is to use [Map.of][map-of-javadoc] or [Map.ofE Map temperatures = Map.of("Mon", 30, "Tue", 28, "Wed", 32); // or using Map.ofEntries -Map temperatures2 = Map.ofEntries(Map.entry("Mon", 30, "Tue", 28, "Wed", 32)); +Map temperatures2 = Map.ofEntries( + Map.entry("Mon", 30), + Map.entry("Tue", 28), + Map.entry("Wed", 32) +); ``` Unlike `HashMap`, they populate the map upfront and become read-only once created.