commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Fischer" <ple...@snafu.de>
Subject Re: [collections] Would like to contribute my RangeIterator
Date Fri, 03 May 2002 08:55:46 GMT
After the discussion about it, I decided to post the Rangeiterator.
May you like it.

Bye

Oliver


----- Original Message -----
From: "Jack, Paul" <pjack@sfaf.org>
To: "'Jakarta Commons Developers List'"
<commons-dev@jakarta.apache.org>
Sent: Tuesday, April 30, 2002 7:07 PM
Subject: RE: [collections] Would like to contribute my RangeIterator


> And to use a RangeIterator over a collection that isn't sorted,
> you'd probably create a sorted collection first:
>
>    new TreeSet(collection, comparator).subSet(first,
last).iterator();
>
> seems like it does what RangeIterator does.
>
> -Paul
>
> -----Original Message-----
> From: James Strachan [mailto:james_strachan@yahoo.co.uk]
> Sent: Tuesday, April 30, 2002 1:00 AM
> To: Jakarta Commons Developers List
> Subject: Re: [collections] Would like to contribute my RangeIterator
>
>
> From: "Oliver Fischer" <plexus@snafu.de>
> > Is there a PredicateIterator already?
>
> Actually its called FilterIterator right now.
>
> > Haven't seen it in the API doc
> > for the collections? I think the FilterIterator is quite close to
it.
> > The my RangeIterator will stop, if the right border is reached,
while
> > (?) the FilterIterator evaluates every object. Think about
iterators
> > which point to a huge amount of objects...
>
> Though that assumes that the underlying iterator returns objects
sorted (in
> the right ascending/descending order) that the left & right
predicates are
> is based on. This sounds a bit specific to me; maybe this should be
done
> using an 'Index' class of some kind to mimic the sorting and range
features.
> For the general approach of filtering an iterator the existing
Filterterator
> seems fine which works on any Predicates and irrespective of
sorting...
>
> Predicate predicate = new Predicate() {
>     public boolean evaluate(Object object) {
>         Foo foo = (Foo) object;
>         return foo.getAge() > 12 and foo.getAge() < 67;
>     }
> }
> return new FilterIterator( iterator, predicate );
>
> James
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>
>
>
>

Mime
View raw message