tag:blogger.com,1999:blog-4815481734454081491.post7862932275550319545..comments2023-10-24T02:15:03.269-07:00Comments on Minborg's Java Pot: Protect Your Immutable Object Invariants in More Complex Java ObjectsPer Minborghttp://www.blogger.com/profile/08526963148025854611noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-4815481734454081491.post-22430094576395851052016-05-04T04:06:02.949-07:002016-05-04T04:06:02.949-07:00I don't think this is an ideal design to retur...I don't think this is an ideal design to return a List but make it unmodifiable under the covers. You are effectively misinforming a user of that object about its return types, as there's nothing on your class that would warn a user that the returned list is read-only and is out of bounds.<br /><br />Wouldn't it be much simpler and clearer to change List<String> getWorks() to Iterable<String> getWorks()?Stashttps://www.blogger.com/profile/10288352637682042387noreply@blogger.com