Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

1
  • 5
    The design of the unmodifiable collections would have been greatly enhanced if the wrappers included an indication of whether the thing being wrapped was already immutable, and there were immutableList etc. factory methods which would return a read-only wrapper around a copy of a passed-in list unless the passed-in list was already immutable. It would be easy to create user-defined types like that but for one problem: there would be no way for joesCollections.immutableList method to recognize that it shouldn't need to copy the object returned by fredsCollections.immutableList. Commented Jul 14, 2014 at 16:27