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.

Implementation

@override
void rebalanceAll() {
  final elements = toList();
  // bypass the wrapper because the components are already added
  super.clear();
  elements.forEach(super.add);
}