remove method

  1. @override
bool remove(
  1. Object? item
)
override

Removes value from the set.

Returns true if value was in the set, and false if not. The method has no effect if value was not in the set.

final characters = <String>{'A', 'B', 'C'};
final didRemoveB = characters.remove('B'); // true
final didRemoveD = characters.remove('D'); // false
print(characters); // {A, C}

Implementation

@override
bool remove(Object? item) {
  if (item is! V) return false;

  AvlNode<V>? x = _getNode(item);
  if (x != null) {
    _removeNode(x);
    return true;
  }
  return false;
}