Correct implementation of retainAll