eraseOne method
- T element
Removes a single instance of element from the set. Time complexity: O(log N).
Returns true if an element was removed, false otherwise.
Implementation
bool eraseOne(T element) {
final currentCount = _container[element];
if (currentCount == null) return false;
if (currentCount > 1) {
_container[element] = currentCount - 1;
} else {
_container.remove(element);
}
_size--;
return true;
}