lookup method

V lookup (Object element)
override

See Set.lookup

Implementation

V lookup(Object element) {
  if (element is! V || _root == null) return null;
  AvlNode<V> x = _root;
  int compare = 0;
  while (x != null) {
    compare = comparator(element as V, x.object);
    if (compare == 0) {
      return x.object;
    } else if (compare < 0) {
      x = x.left;
    } else {
      x = x.right;
    }
  }
  return null;
}