### Question:
FilterChain implements Filter<T> { @Override public Set<T> apply( Set<T> data ) { for ( Filter<T> filter : chain ) { data = filter.apply( data ); } return data; } FilterChain( List<Filter<T>> chain ); @Override Set<T> apply( Set<T> data ); @Override boolean equals( Object o ); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void shouldFilterThroughAll() { Filter<Integer> removeValuesOfFive = data -> data.stream().filter( value -> value != 5 ).collect( Collectors.toSet() ); Filter<Integer> mustHaveThreeValues = data -> data.size() == 3 ? data : emptySet(); Filter<Integer> keepValuesBelowTen = data -> data.stream().filter( value -> value < 10 ).collect( Collectors.toSet() ); FilterChain<Integer> filterChain = new FilterChain<>( asList( removeValuesOfFive, mustHaveThreeValues, keepValuesBelowTen ) ); Set<Integer> data = asSet( 5, 5, 5, 3, 5, 10, 9 ); data = filterChain.apply( data ); assertEquals( asSet( 3, 9 ), data ); }