lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ganyo <scott.ga...@etapestry.com>
Subject Re: AW: getAllFieldNames diffs
Date Wed, 13 Nov 2002 15:15:33 GMT
+1.  In general, I don't believe that returning Iterators is a good 
idea.  Whenever feasible, I would return a Collection instead of an 
Iterator.

Scott

Materna, Wolf-Dietrich (empolis B) wrote:

> [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:
> For additional commands, e-mail: 


-- 
Brain: Pinky, are you pondering what I’m pondering?
Pinky: I think so, Brain, but calling it a pu-pu platter? Huh, what were 
they thinking?


--
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