I guess I should have commented this line as well (I have comments elsewhere).

If you look at how the ordering for the SortedSet is made, it only works for keys currently in the mapping that we create when the SortedSet is created (check the updatedHeavyHitters method). This means that if you add new elements to it not in that mapping, it will throw an error (we could of course change this, but regardless the ordering will need to be redone, which it is here later when that method is called again). So going through iterator seemed like the cheapest way to ensure we'll leave sorted set land.