containsNode method

bool containsNode(
  1. Object key
)

Check if the stack contains a node with the provided key

Implementation

bool containsNode(Object key) {
  if (this.key == key) {
    return true;
  } else if (next case final next?) {
    return next.containsNode(key);
  }

  return false;
}