Sure, I just write “deterministic based on a hidden variable” more concisely as 
“non-deterministic”; they mean about the same thing.

When you say “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.



From: Ryan Ernst <[email protected]>
Date: Friday, September 5, 2025 at 8:45 AM
To: Kevin Bourrillion <[email protected]>
Cc: Stephen Colebourne <[email protected]>, core-libs-dev 
<[email protected]>
Subject: [External] : Re: StableValue and non-deterministic iteration order
The iteration order is deterministic. The problem raised in that thread was 
that the seed is hidden and uncontrollable.

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.


On Sep 5, 2025, at 08:23, Kevin Bourrillion <[email protected]> 
wrote:

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.)


From: core-libs-dev <[email protected]> on behalf of Stephen 
Colebourne <[email protected]>
Date: Friday, September 5, 2025 at 12:13 AM
To: core-libs-dev <[email protected]>
Subject: StableValue and non-deterministic iteration order

In summary, the current Map.of() is a bit of a hand grenade IMO, and
something I pretty much banned at my previous company. Which is a
problem given its key role in StableValue.

Stephen

Reply via email to