Is it OK to use a NOT on (negate) a Set.contains()
method, or should I use an if/else
, or does it not really matter?
Use NOT on contains()
:
if (!psxAssigneeIds.contains(cgm.MemberId)) {
cgUsersToDeleteSet.add(cgm);
}
or is it better to use else
:
if (psxAssigneeIds.contains(cgm.MemberId)) {
// do nothing
} else {
cgUsersToDeleteSet.add(cgm);
}
or would both work equally well?