toggle method

bool toggle(
  1. T value
)

add or remove given value from current Set

the value will removed if it was already included in Set

Implementation

bool toggle(T value) {
  if (contains(value)) {
    remove(value);
    return false;
  }

  add(value);
  return true;
}