how to add filter to an iterator