[jdom-interest] Re: [jdom-commits] CVS update: jdom/src/java/org/jdom

Jason Hunter jhunter at collab.net
Wed Oct 10 12:42:31 PDT 2001

Noam Tamim wrote:
> --- jhunter at cvs.jdom.org wrote:
> > I also implemented PartialList.listIterator() to throw
> > UnsupportedOperationException since it's not yet implemented, and
> > probably won't be since FilterList will replace PartialList.  No one
> > probably calls the method anyway, but this way in case anyone does they
> > won't wonder why it doesn't work.
> I'm not sure it's acceptable to just throw an UnsupportedOperationException
> from listIterator(). ListIterator is supposed to be SUPPORTED by any class
> that implements List.

If we don't have an impl, it's better to be bad and throw than be really
bad and return something that doesn't work.  We could also throw a
regular RuntimeException saying "Not implemented yet, sorry" which might
be better for a beta product.  UOE does look permanent.

> Another way to imeplement ListIterator is to forward all calls to previous(),
> hasPrevious() etc. to the "selfIterator", then have set(Object) and
> add(Object) throw the exception.
> I actually did it, just after sending you the code for iterator()... Do you
> want it?

Sounds good.  Extra credit if set() and add() can be made to work.  ;-)


More information about the jdom-interest mailing list