Design Patterns Filter Pattern - Design Patterns

What is Design Patterns Filter Pattern?

Filter pattern or Criteria pattern is a propose pattern that enables developers to filter a set of objects using different criteria and chain them in a decoupled way through logical operation. This type of design pattern comes under structural pattern as this pattern combines many criteria to find single criteria.


We're going to make a Person object, Criteria interface and concrete lessons implementing this interface to filter directory of Person objects.

CriteriaPatternDemo, our demo class uses Criteria substance to filter List of Person substance based on different criteria and their combination.


Step 1

Create a class on which criteria is to be practical.

Step 2

Generate an interface for Criteria.

Step 3

Construct concrete classes implementing the Criteria interface.


Apply changed Criteria and their arrangement to filter out persons.

Step 5

Verify the output.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Design Patterns Topics