lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Materna, Wolf-Dietrich (empolis B)" <>
Subject AW: getAllFieldNames diffs
Date Wed, 13 Nov 2002 09:14:14 GMT
[Clemens Marschner]
> > Instead of returning Object[] or Collection I would 
> > consider returning an
> > iterator. Iterators may be designed data-driven, that is, temporary
> > objects are only created when next() is called and not at the time 
> > the method is called. There are powerful frameworks like the XXL library
> > extensively use iterators to implement cursors efficiently
> >
> > Finally Iterators are supposed to be the standard mechanism 
> > to returning collections in Java, aren't they?

[Peter Mularien] 
> Your reasoning is logical, and it fits in nicely with many of 
> the existing API calls returning Enumeration.
Sorry, but I don't agree.
Iterators and enumations doesn't support serveral useful operations, for
instance get 
the number of elements. You have to loop over all elements, which is a bad
Note that iterators are suitable for very large collections of elements
all terms or documents in a index, but the number of fields is always small.
That means
you can't compare both cases. You will restrict only the benefit of your
function and make 
some things harder.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message