New candidate JEP: 431: Sequenced Collections
Remi Forax
forax at univ-mlv.fr
Fri Oct 14 08:20:51 UTC 2022
----- 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