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: getAllFieldNames diffs
Date Wed, 13 Nov 2002 15:36:48 GMT
Follow up to my other comment about not passing Iterators.  Here is the 
"official" word from the designer of the Java Collections API:

http://java.sun.com/products/jdk/1.2/docs/guide/collections/designfaq.html#8

Scott

Clemens Marschner wrote:

> 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?
>
> Clemens
>
> ----- Original Message -----
> From: "Peter Mularien"
> To: "Lucene Developers List"
> Sent: Tuesday, November 12, 2002 9:33 PM
> Subject: Re: getAllFieldNames diffs
>
>
>
> >Personal preference. I don't tend to like returning arrays from methods
> >unless I have to, primarily because then the caller has to check for a
> >null value being returned. When returning Collection (or other Set-type
> >object) it is easy to always return a value, even if the object is
> >empty. For this particular method, it seemed useful also to be able to
> >test for memership, do sorting, etc., although I suppose
> >java.util.Arrays can do most of that anyway.
> >
> >Peter
> >
> >Otis Gospodnetic wrote:
> >
> >
> >>Nice :)
> >>I looked at the code first, and was about to ask - why not just return
> >>String[]?  What is the advantage of Collection in this case?
> >>
> >>Thanks,
> >>Otis
> >>
> >>
> >>
> >>
> >
> >
> >--
> >To unsubscribe, e-mail:
>
>
>
> >For additional commands, e-mail:
>
>
>
>
>
> --
> 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