The non-deterministic iteration order of Immutable Collections
Kasper Nielsen
kasperni at gmail.com
Sun Mar 26 10:48:54 UTC 2023
On Sun, 26 Mar 2023 at 10:38, Jens Lideström <jens at lidestrom.se> wrote:
>
> I think Map#of and friends would be more useful and less error prone if they where to return collections that have a fixed iteration order, where the order is defined by the insertion order when the map is created.
The problem is that everyone will have to pay for the extra storage cost for
maintaining insertion order. Even if people don't need it. Hence, why I
suggested adding factory/copyOf methods for SequencedMap/SequencedSet
for those people that need to rely on order. (Rereading Chris's email I know it
wouldn't help his use-case).
/Kasper
More information about the core-libs-dev
mailing list