minusElement method

KtSet<T> minusElement(
  1. T element
)

Returns a set containing all elements of the original collection without the first occurrence of the given element.

Implementation

KtSet<T> minusElement(T element) {
  final result = KtMutableSet<T>.of();
  var removed = false;
  filterTo(result, (it) {
    if (!removed && it == element) {
      removed = true;
      return false;
    } else {
      return true;
    }
  });
  return result;
}