init method

void init()

Implementation

void init() {
  // already built
  if (root != null) return;

  /**
   * if leaves is empty then nothing has been inserted.
   * In this case it is safe to leave the tree in an open state
   */
  if (leaves.isEmpty) return;

  buildRoot();
}