abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garrett Rooney" <roo...@electricjellyfish.net>
Subject Re: Model api changes
Date Fri, 14 Jul 2006 01:04:58 GMT
On 7/13/06, Robert Sayre <sayrer@gmail.com> wrote:
> On 7/13/06, Garrett Rooney <rooneg@electricjellyfish.net> wrote:
> > On 7/13/06, James M Snell <jasnell@gmail.com> wrote:
> > > There are a number of aspects of the model api that have been bugging me
> > > for some time.
> > >
> > > For instance,
> > >
> > > Feed.getEntries() returns a List, however, Feed.getEntries().add(...)
> > > doesn't actually do anything.  It makes more sense for Feed.getEntries()
> > > to return an Iterator given that it's primary purpose is iterating
> > > through the entries.  Doing so also allows us to optimize the underlying
> > >  Axiom code (which provides efficient element iterators).
> >
> >  Returning an Iterator at least makes it clear
> > that there was no deep copy type semantics going on.
>
> FWIW, the Java convention is to use a List. See
> Collections.unmodifiableList(), etc.

Sure, but "unmodifiableList()" gives some indication to the caller
that they can't modify the list and expect it to change something.
The current method name isn't nearly as clear about such things, and
the javadoc doesn't specify.

-garrett

Mime
View raw message