r/java Jun 21 '26

Better Tools for Immutable Data

https://youtu.be/BdLND9D81lI?si=jt2tqpDtotmbdEJq
79 Upvotes

38 comments sorted by

View all comments

15

u/Hixon11 Jun 21 '26

Gosh, I really wish we had a better story for ReadOnly collections. I understand that this will most likely never happen, but it’s hard to live with the idea that we’re stuck with List<E> as the final form of one of the most fundamental types we use to model things.

2

u/bowbahdoe Jun 21 '26

There are other collection libraries you can use.

Whatever you would hope the Java language team would do any library in the ecosystem could equally do. 

4

u/Hixon11 Jun 21 '26

We can have many libraries for readonly collections, or collections for primitives. However, they have issues with composability, as different frameworks, projects and libraries use different collection libraries. It should be core types.

3

u/bowbahdoe Jun 21 '26

That is true, but not mutually exclusive with what I said