rebalanceAll method

  1. @override
void rebalanceAll()
override

Allows you to rebalance the whole tree. If you are dealing with non-deterministic compare functions, you probably need to consider rebalancing. If the result of the priority function for some elements changes, rebalancing is needed. In general, be careful with using comparing functions that can change. If only a few known elements need rebalancing, you can use rebalanceWhere. Note: rebalancing is not stable. Note: this is a potentially expensive operation, and should be used sparingly.

Implementation

@override
void rebalanceAll() {
  final elements = toList(growable: false);
  clear();
  addAll(elements);
}