lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Materna, Wolf-Dietrich (empolis B)" <Wolf-Dietrich.Mate...@empolis.com>
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
that
> > 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
solution.
Note that iterators are suitable for very large collections of elements
containing
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.
Regards,
	Wolf-Dietrich

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message