Tag Archives: Iterators

Iterators, Functors and Predicates

In this post I am sharing different ways to create ‘Custom Iterators’ and how to control the behavior of that Iterator.

Also part of this article focuses on how to apply different operations on a selected elements within a custom iterator.

The way to do this is to implement a new Iterator-subclass and pass it Functors and Predicates.

By the way Google has implemented all these and more within the Guava Framework, you just need to include this framework as part of your project.

So what are functors and predicates?

Functor: Functor is an interface implementation that apply an operation or status change on an object passed to it’s operation method.
Continue reading