Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] lack of iterators in the API

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: "Regier Avery J" <RegierAveryJ AT JohnDeere.com>, "'xom-interest AT lists.ibiblio.org'" <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] lack of iterators in the API
  • Date: Fri, 27 Sep 2002 10:20:38 -0400

At 8:49 AM -0500 9/27/02, Regier Avery J wrote:
Hello,

I was very curious while perusing the JavaDoc that there are absolutely no
Iterators in the API.

Is this on purpose? I didn't see it listed as a design consideration.

In my own API's I provide type-safe (or castless) iterators that implement
Iterator, Enumeration, and ListIterator via handy base classes. This
provides that the iterators returned can be used easily with virtually any
API. I would also provide methods such as:
public Foo nextFoo();
public Foo previousFoo();
to provide a type safe iteration.

If you have any objections to iterators, would the above approach mitigate
those concerns?


Only partially. I prefer not to clutter the API with multiple ways of doing the same thing. Since indexed access is provided, I don't want to provide iterators too. Simplicity is a feature. If you want me to add a feature you have to show me that it would be a major simplification, or allow something to be done that cannot currently be done, or is better than what is in the current API and thus should replace what is in the current API.

There are getNextSibling() and getPreviousSibling() methods in Node.
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| XML in a Nutshell, 2nd Edition (O'Reilly, 2002) |
| http://www.cafeconleche.org/books/xian2/ |
| http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+




Archive powered by MHonArc 2.6.24.

Top of Page