geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Blewitt <>
Subject Re: [General] Container interface and AbstractContainer
Date Thu, 14 Aug 2003 12:31:50 GMT

On Thursday, Aug 14, 2003, at 13:25 Europe/London, Jason Dillon wrote:

> If the list should not be mutable, then it makes more sense to return 
> an Iterator (or ListIterator as mentioned), else someone could violate 
> the contract and insert random fluff into the list instead of using 
> the add/remove methods.

There are things you can do with an immutable list that you can't do 
with an (List)Iterator. One of them is to find out how big it is (using 
.size()), another is to add the contents into a new collection( new 
ArrayList(list)), for example.

Whether those methods are needed or not is debatable, but at least if 
you get the (immutable) list, then you can get the Iterator, 
ListIterator, size, xxxx etc.


View raw message