Hi,

in compress I've added a method to ZipFile that provides access to a
subset of the entries.  It already contained a method returning an
Enumeration of all entries - Enumeration as it mimics java.util.ZipFile
which was invented in Java 1.0.

For this new method I've chosen to return an Iterator for now - there is
no reason to use Enumeration and it seemed to be closest.  In fact I
first implemented it returning Iterable and changed it later.

I've been doing quite a bit of .NET over the past years and there
IEnumerable would have been the no-brainer choice - which translates
into Iterable in Java.  Lot's of .NET APIs use IEnumerable.

My personal preference would be Iterable as well as the consumer may
iterate over the return value multiple times without copying stuff
around, but I may be missing something.

There don't seem to be many APIs in the Java classlib that consume
Iterators or Iterables at all.  That's why I bring up Collection in the
subject.

Any insights or recommendations what to return?

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to