smallest property

dynamic smallest

Returns the smallest value in the tree.

The returned value is either:

  • null, if this tree is empty
  • a single value of type T, if this tree doesn't support equivalence classes
  • a list of type List[T], if this tree does support equivalence classes

Implementation

dynamic get smallest {
  var n = _root;
  if (n == null) return null;
  while (n!.left != null) n = n.left;

  if (this._withEquivalenceClasses) {
    return n.values;
  } else {
    return n.values.first;
  }
}