Hello,
In my program I've a data model, and to access data I'm using java-style iterators.
Since data has to be filtered somehow, I was thinking about using iterator filtering.

In other words, given a java style iterator, I would build another custom iterator, say FilteredIterator, which takes the original iterator and the filter parameter. The filtering is applied automatically when using .hasNext() and .next() methods on the FilterIterator.

Does something like this exist? Shall I use some abstract type or guideline when implementing java-style iterators? Do you think this approach is Ok? I couldn't find much information about this kind of iterators and having experience with stl-like iterators, I'm not sure about how to proceed.

I've some ideas on how to do it (just implement the class with required methods), but I appreciate any advice on this topic.

Thanks in advance for any help
~Aki