lookup method

  1. @override
V lookup (
  1. Object element
)
override

See Set.lookup

Implementation

@override
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, x.object);
    if (compare == 0) {
      return x.object;
    } else if (compare < 0) {
      x = x.left;
    } else {
      x = x.right;
    }
  }
  return null;
}