New candidate JEP: 431: Sequenced Collections
Attila Kelemen
attila.kelemen85 at gmail.com
Fri Oct 14 19:18:54 UTC 2022
Let me be the exception: I do care :)
Sure, it is not something earth shaking, but I was always missing this
abstraction, and I feel it is nice to have.
As for the cost: Will it really be so much of a burden on the
community? I mean, if your library is commonly used already, then of
course it is not an issue. If your library is the next guava, and just
about to be included in all projects, then people might feel forced to
update their API, but then we are already talking about the adoption
of a new very useful dependency which will probably make the
additional methods to be insignificant (relatively speaking).
About old classes: Is it really realistic to expect this interface to
make something very hard, yet the current interfaces don't make it so
already?
Attila
Remi Forax <forax at univ-mlv.fr> ezt írta (időpont: 2022. okt. 14., P, 10:21):
>
> ----- Original Message -----
> > From: "mark reinhold" <mark.reinhold at oracle.com>
> > To: "Stuart Marks" <stuart.marks at oracle.com>
> > Cc: "core-libs-dev" <core-libs-dev at openjdk.org>, "jdk-dev" <jdk-dev at openjdk.org>
> > Sent: Wednesday, October 12, 2022 1:17:20 AM
> > Subject: New candidate JEP: 431: Sequenced Collections
>
> > https://openjdk.org/jeps/431
> >
> > Summary: Introduce new interfaces to represent collections with a
> > defined encounter order. Each such collection has a well-defined first
> > element, second element, and so forth, up to the last element. It also
> > provides uniform APIs for accessing its first and last elements, and
> > for processing its elements in reverse order.
>
> People will again think that i'm the grumpy guy but i prefer to voice my concerns.
>
> - nobody cares, i'm back from Devoxx and nobody cares about Sequenced Collections, i've tried to ask several friends what they think about it and the answer was "meh".
> The bar to introduce new interfaces in the collection API is really really high given how the Java ecosystem works.
> Once a library starts to use those interfaces as method parameter, it pressures the other library authors to write methods that provides object typed as those interfaces.
> Not enough people care and the cost for the community (not only Oracle) is high, it looks like a recipe for failure.
>
> - LinkedHashMap can be tweaked in two ways, by passing an access order as 3rd parameter of the constructor or by overriding removeEldesEntry(), in both cases the resulting LinkedHashMap is at odds with the contract of SequencedMap but the compiler will happily allow to see those LinkedHashMap as SequencedMap.
>
> - LinkedHashMap/LinkedHashSet are dinosaurs, there are more efficient implementations of the concepts of ordered set / ordered map both in term of memory footprint and runtime execution, so adding new interfaces without exploring new implementations using Valhalla value class and in relation with the Collection Literal JEP seems premature to me.
>
> >
> > - Mark
>
> Rémi
More information about the jdk-dev
mailing list