"There are Sets that can contain null values, so this is a legitimate check." yes, and those sets have their own implementation of
contains
. For example HashSet
doesn't have that check.