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 Tue, 30 Apr 2002 06:28:25 GMT
----- Original Message -----
From: "Morgan Delagrange" <mdelagra@yahoo.com>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Monday, April 29, 2002 5:25 PM
Subject: RE: [collections] Would like to contribute my RangeIterator

> Well, presumably it's an iterator wrapper, not a list
> operation, right Oliver?  So it would be useful for
> interfaces that only provide access through iterators.

Yes, it is like this. My colleagues and I, we recognized that we
implemented a lot of stuff which is comparable to the classes in the
collection package. For example the FilterIterator. The main
difference is, that we use a lot of stuff from the jgl packages.



>
> It sounds a bit specialized to me, especially since it
> seems to assume that the iterations are returned in
> order.  Could you provide a few use cases?
>

final Predicate leftBoder = new Predicate() {
      public boolean evaluate(Object input)
      {
           Member o = (Member)input;
           return member.getAge() < 18;
      }};

final Predicate rightBorder = new Predicate() {
      public boolean evaluate(Object input)
      {
           Member o = (Member)input;
           return member.getAge() > 65;
      }

Iterator i = new RangeIterator(leftBoder, sourceiterator,
rightBorder);


In this example, I apply to predicates to the sourceiterator and when
iterating, I should ;) only get the members older then 17 and 65.

Bye

Oliver




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