erase method

bool erase(
  1. K key
)

Removes the element with the specified key. Time complexity: O(log N).

Returns true if the key was found and removed, false otherwise.

Implementation

bool erase(K key) {
  if (_container.containsKey(key)) {
    _container.remove(key);
    return true;
  }
  return false;
}