build method

void build()

Creates parent nodes, grandparent nodes, and so forth up to the root node, for the data that has been inserted into the tree. Can only be called once, and thus can be called only after all of the data has been inserted into the tree.

Implementation

// TODO check how to make this method synchronized
void build() {
  if (built) return;
  root = itemBoundables!.isEmpty
      ? createNode(0)
      : createHigherLevels(itemBoundables!, -1);
  // the item list is no longer needed
  itemBoundables = null;
  built = true;
}