docs: public boolean next() {
      if (!isInitialized_) {
        level_ = 0;
        i_ = levels_[level_];
        weight_ = 1;
        isInitialized_ = true;
      } else {
        i_++;
      }
      if (i_ < levels_[level_ + 1]) {
        return true;
      }
      // go to the next non-empty level
      do {
        level_++;
        if (level_ == numLevels_) {
          return false; // run out of levels
        }
        weight_ *= 2;
      } while (levels_[level_] == levels_[level_ + 1]);
      i_ = levels_[level_];
      return true;
    }