in packages/fbjs/src/struct/IntegerBufferSet.js [139:161]
_recreateHeaps() {
const sourceHeap = this._smallValues.size() < this._largeValues.size() ?
this._smallValues :
this._largeValues;
const newSmallValues = new Heap(
[], // Initial data in the heap
this._smallerComparator
);
const newLargeValues = new Heap(
[], // Initial datat in the heap
this._greaterComparator
);
while (!sourceHeap.empty()) {
const element = sourceHeap.pop();
// Push all stil valid elements to new heaps
if (this._valueToPositionMap[element.value] !== undefined) {
newSmallValues.push(element);
newLargeValues.push(element);
}
}
this._smallValues = newSmallValues;
this._largeValues = newLargeValues;
}