toggle method

ISet<T> toggle(
  1. T item
)

Removes the element, if it exists in the set. Otherwise, adds it to the set.

Implementation

ISet<T> toggle(T item) => contains(item) ? remove(item) : add(item);