groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessio Stalla <>
Subject Re: peristant and immutable collections
Date Wed, 14 Oct 2015 16:01:10 GMT
On Wed, Oct 14, 2015 at 5:54 PM, Winnebeck, Jason <> wrote:
> What I don’t get about pcollections is that it promises to implement
> collections interfaces like Java.util.List, but then says that “add”
> doesn’t work, because you have to use plus. So, I’m not sure how it can
> really be a List when none of the mutators could work. I suppose you can
> implement size, iterator, contains, etc. same as Java’s unmodifiableList.

The Java Collections API specifies all mutator methods to be optional, i.e.
conforming implementations can throw UnsupportedOperationException.
Granted, it would have been better to have separate List and MutableList
interfaces, but that's how it is. All in all, the Java Collections API is
surprisingly good after all these years, in my opinion.

View raw message