There are some not needed checks on List and Set collections that don't bring any value besides restating the behavior or these collections.
Calling contains on a list only takes processing power but does not add any value.
Even if contains returns true, remove will have to locate the element once again so there is no performance gain of having this check.
This means that without loosing the behavior, it can be replaced with a simpler:
Similarly with sets:
It's a Set, so the uniqueness of elements is given to us for free.
This can be replaced with: