implemented the retainAll method