<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Map-Of on Devops Monk</title><link>https://devops-monk.com/tags/map-of/</link><description>Recent content in Map-Of on Devops Monk</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 04 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://devops-monk.com/tags/map-of/index.xml" rel="self" type="application/rss+xml"/><item><title>Collection Factory Methods (JEP 269): Immutable List, Set, and Map</title><link>https://devops-monk.com/tutorials/java11/collection-factory-methods/</link><pubDate>Mon, 04 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/java11/collection-factory-methods/</guid><description>Why Collection Factory Methods? Before Java 9, creating a small immutable collection was tedious:
// Java 8 — three lines, two classes, mutable intermediate List&amp;lt;String&amp;gt; names = Collections.unmodifiableList( Arrays.asList(&amp;#34;Alice&amp;#34;, &amp;#34;Bob&amp;#34;, &amp;#34;Charlie&amp;#34;) ); // Java 8 — even worse for Map Map&amp;lt;String, Integer&amp;gt; scores = new HashMap&amp;lt;&amp;gt;(); scores.put(&amp;#34;Alice&amp;#34;, 90); scores.put(&amp;#34;Bob&amp;#34;, 85); Map&amp;lt;String, Integer&amp;gt; immutableScores = Collections.unmodifiableMap(scores); JEP 269 (Java 9) introduced static factory methods that create truly immutable collections with a single expression:</description></item></channel></rss>