|Builders for immutable collections (*List). [message #1783177]
||Thu, 08 March 2018 20:20
| Steve Harris
Registered: March 2018
I commonly come across cases where I need to mutably build a large list of items within a single method, then "finalize it" as an immutable list to return.
I'd like to be able to do without having to copy the items like toImmutableList() would when called on the mutable lists. The mutable "builder" form of the thing doesn't have to conform to any specific interfaces other than having an "add" method for my purposes - and it would give up it's reference to the data when building the immutable list. Is there any way of doing this currently, or would such a feature be considered as an enhancement?
Powered by FUDForum
. Page generated in 0.01593 seconds