StableValue and non-deterministic iteration order

Stephen Colebourne scolebourne at joda.org
Mon Sep 8 07:58:53 UTC 2025


On Mon, 8 Sept 2025 at 08:34, Per-Ake Minborg
<per-ake.minborg at oracle.com> wrote:
> I think there is a more general discussion to be had that should be aligned with the direction of the immutable collections and any potential constructs with deterministic order there.

I agree, because the direction of travel for Map.of() influences
StableValue: ie. I don't think StableValue should be released until
this thread/issue is decided.

* If the decision is to add SequencedMap.of() and SequencedSet.of(),
then it would make sense for StableValue.map() to return SequencedMap,
not Map.
* However, if the decision is to alter Map.of() and Set.of() and
friends to retain their input order, then StableValue.map() is fine
returning a Map.

(Personally, I would prefer to see Map.of() and friends retain their
input order, as I think that is by far what most developers expect,
and I think the performance overhead is hugely overblown as an issue.)
thanks
Stephen


More information about the core-libs-dev mailing list