Factory methods for SequencedSet and SequencedMap

Archie Cobbs archie.cobbs at gmail.com
Fri Jan 17 15:34:50 UTC 2025


On Fri, Jan 17, 2025 at 9:22 AM Ethan McCue <ethan at mccue.dev> wrote:

> Just so there are some strawman arguments against:
>

To pile on...

If I go to a restaurant and order a hamburger and they bring me a
cheeseburger and also charge me extra for it, I'm going to complain!

A Set and a SequencedSet are two different things. The latter comes with
cheese but also has a higher cost.

If I order a Set and get a SequencedSet, I am going to wonder why am I
paying extra for preserving insertion order?

If I order a Set and get a SortedSet, I am going to wonder why am I paying
extra for keeping the elements sorted?

If I order a SortedSet and get a NavigableSet, I am going to wonder why am
I paying extra for navigation?

If I had wanted a SequencedSet, I would have asked for one. So YES I am
also agreeing here that there should be a SequencedSet.of() method to
handle this need.

-Archie

-- 
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250117/a517dd52/attachment.htm>


More information about the core-libs-dev mailing list