In a Filter.doFilter method I made this call chain.doFilter.
What is doFilter doing inside a doFilter? Isn\'t it a recursive call?
Not having any code that you are talking about, I can only assume that you something like:
class Filter implements FilterAPI {
private FilterAPI chain;
FilterAPI(FilterAPI chain) { this.chain = chain; }
@override void doFilter (Set setToFilter) {
// do some filtering on setToFilter
chain.doFilter(setToFilter);
}
}
If that is the case, then you are not calling anything recursively, you are calling doFilter() on a different object. As mentioned on an another answer, this is the well known Chain of Responsibility design pattern.