<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:10.0pt;
font-family:"Aptos",sans-serif;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:12.0pt">Sure, I just write “deterministic based on a hidden variable” more concisely as “non-deterministic”; they mean about the same thing.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">When you say “</span><span style="font-size:12.0pt">if you want a Map that has order, use…” this illustrates the notion that things should be faster and less safe by default, and users can explicitly opt into
more safety/predictability when they know they need it. I personally feel history has proven this approach doesn’t work out well.</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Ryan Ernst <ryan@iernst.net><br>
<b>Date: </b>Friday, September 5, 2025 at 8:45</span><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black"> </span><span style="font-size:12.0pt;color:black">AM<br>
<b>To: </b>Kevin Bourrillion <kevin.bourrillion@oracle.com><br>
<b>Cc: </b>Stephen Colebourne <scolebourne@joda.org>, core-libs-dev <core-libs-dev@openjdk.org><br>
<b>Subject: </b>[External] : Re: StableValue and non-deterministic iteration order<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">The iteration order is deterministic. The problem raised in that thread was that the seed is hidden and uncontrollable. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">IMO if you want a Map that has order, use a LinkedHashMap (or the idea is SequencedMap.of is also appealing). However, even if you don’t want to depend on iteration order, sometimes there are bugs that unintentionally
depend on that order, so it would still be great to control the seed in order to have reproducibility in tests. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><br>
<br>
<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:12.0pt">On Sep 5, 2025, at 08:23, Kevin Bourrillion <kevin.bourrillion@oracle.com> wrote:<o:p></o:p></span></p>
</blockquote>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Calibri",sans-serif"></span><span style="font-size:12.0pt">
</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Just as a corroborating data point, it’s banned at my previous company too, and this is a big reason why. Deterministic iteration is a very good thing. (Personal opinion: I’ve come to view non-deterministic
iteration as a risky optimization in general, that is usually not called for.)</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt"> </span><o:p></o:p></p>
<div id="mail-editor-reference-message-container">
<div>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">core-libs-dev <core-libs-dev-retn@openjdk.org> on behalf of Stephen Colebourne <scolebourne@joda.org><br>
<b>Date: </b>Friday, September 5, 2025 at 12:13</span><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black"> </span><span style="font-size:12.0pt;color:black">AM<br>
<b>To: </b>core-libs-dev <core-libs-dev@openjdk.org><br>
<b>Subject: </b>StableValue and non-deterministic iteration order</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><br>
In summary, the current Map.of() is a bit of a hand grenade IMO, and<br>
something I pretty much banned at my previous company. Which is a<br>
problem given its key role in StableValue.<br>
<br>
Stephen</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>