May 13, 2014
3:19 p.m.
On 13/05/14 15:50, Alexandre Bergel wrote:
I got an interest some years ago, to see if Context-Oriented-Programming would help to have immutable collections.
Apparently, Java supports immutability at runtime (i.e., there is no class ImmutableArrayList as far as I know).
Actually there is. Have a look at java.util.Collections, java.util.Collections.UnmodifiableList/UnmodifiableRandomAccessList in particular. Many libraries define their own immutable collections as far as I have seen. There's no support for object immutability in the OpenJDK-based JVMs. Cheers, Jan
So, there is no good design for immutable collections as far as I know. I read something about that on Doug Lea web page.
Cheers, Alexandre