<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>What can be done is to have Set.of()/Map.of() to delegate to SequenceSet.of()/SequenceMap.of() so there is only one implementation at runtime.<br></div><div><br data-mce-bogus="1"></div><div>Also, technically, there is a way to change the return type in a binary compatible way ... if union types are supported in the language.<br data-mce-bogus="1"></div><div>In that case, Set.of() can be declared like this<br></div><div><br data-mce-bogus="1"></div><div>  static <E> Set<E> | SequenceSet<E> of(E... ) {<br data-mce-bogus="1"></div><div>   ...<br data-mce-bogus="1"></div><div>  }<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>because of erasure, the binary descriptor will use Set, but the Signature will be Set<E> | SequenceSet<E>  so the compiler will see the return type as a SequencedSet .<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Obviously, union types is a far bigger features than adding SequenceSet/SequenceMap so it's a big if, but it may happen in the future.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Rémi</div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"joe darcy" <joe.darcy@oracle.com><br><b>To: </b>"core-libs-dev" <core-libs-dev@openjdk.org><br><b>Sent: </b>Friday, January 17, 2025 6:30:40 PM<br><b>Subject: </b>Re: Factory methods for SequencedSet and SequencedMap<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div class="moz-cite-prefix">On 1/16/2025 11:26 PM, Rafael
      Winterhalter wrote:<br>
    </div>
    <blockquote cite="mid:CA+DM0A=B8hwo6-yrRq_uwMm=TV+HVj5470n-zE6K-aA89XCWoQ@mail.gmail.com">
      
      <div dir="ltr"> 
        <div>Would it even be possible to change the return types of
          Set.of(...) and Map.of(...) without breaking binary
          compatibility?</div>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>In short, no.</p></blockquote><div><br></div><div>[...]</div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><p><br>
    </p>
    <p>-Joe</p></blockquote><div><br></div><div>Rémi</div><div><br data-mce-bogus="1"></div></div></div></body></html>