<div dir="ltr"><div dir="ltr">maybe you can use some java agent to hack in the of function, and change it to some strange order, to make you see where goes wrong easier?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Remi Forax <<a href="mailto:forax@univ-mlv.fr">forax@univ-mlv.fr</a>> 于2023年3月25日周六 06:13写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">----- Original Message -----<br>
> From: "Kasper Nielsen" <<a href="mailto:kasperni@gmail.com" target="_blank">kasperni@gmail.com</a>><br>
> To: "Chris Hegarty" <<a href="mailto:chegar999@gmail.com" target="_blank">chegar999@gmail.com</a>><br>
> Cc: "core-libs-dev" <<a href="mailto:core-libs-dev@openjdk.org" target="_blank">core-libs-dev@openjdk.org</a>><br>
> Sent: Friday, March 24, 2023 6:53:51 PM<br>
> Subject: Re: The non-deterministic iteration order of Immutable Collections<br>
<br>
>><br>
>> I don't (yet) want to be prescriptive in any potential solution. And I<br>
>> know that this has been discussed before. I mostly just want to start a<br>
>> conversation and see how much traction it gets.<br>
>><br>
> Would<br>
> java.util.SequencedMap.of(...)<br>
> java.util.SequencedMap.copyOf(SequencedMap map)<br>
> java.util.SequencedSet.of(...)<br>
> java.util.SequencedSet.copyOf(SequencedSet set)<br>
> solve your problem?<br>
> <br>
> I would love to see them included in JEP 431.<br>
> Should be fairly simply to implement just have a side<br>
> array that maintains the elements in order.<br>
<br>
I do not think SequenceMap or SequencedSet should be use for copyOf(), Map and Collection should be used instead because the iteration order is enough.<br>
<br>
This is sadly not something acknowledged by JEP 431, but SequencedSet or SequencedMap are not very useful as interfaces for typing the parameters of public methods. Like NavigableSet/NavigableMap, they can be handy for typing a specific implementation for a field or a local variable but for methods, they are not general enough.<br>
<br>
> <br>
> /Kasper<br>
<br>
regards,<br>
Rémi<br>
</blockquote></div></div>