lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clemens Marschner" <c...@lanlab.de>
Subject Re: getAllFieldNames diffs
Date Tue, 12 Nov 2002 23:25:21 GMT
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" <pmularien@deploy.com>
To: "Lucene Developers List" <lucene-dev@jakarta.apache.org>
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:
<mailto:lucene-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:lucene-dev-help@jakarta.apache.org>
>


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