code: public void remapAll(List<IndexPair> listOfOldToNew) {
      List<String> symbols = Lists.newArrayListWithCapacity(listOfOldToNew.size());
      int max = -1;
      for (int i = 0; i < listOfOldToNew.size(); i++) {
        IndexPair indexPair = listOfOldToNew.get(i);
        symbols.add(invert().keyForId(indexPair.getLeft()));
        max = Math.max(max, indexPair.getRight());
      }
      if (max >= nextId) {
        nextId = max + 1;
      }
      // now actually remap them
      for (int i = 0; i < listOfOldToNew.size(); i++) {
        IndexPair pair = listOfOldToNew.get(i);
        String symbol = symbols.get(i);
        idToSymbol.remove(pair.getLeft());
        symbolToId.remove(symbol);
  
        idToSymbol.put(pair.getRight(), symbol);
        symbolToId.put(symbol, pair.getRight());
      }
    }
docs: Remap a set of oldIndex -> newIndex such that this whole thing is done as one operation and you dont have
  to worry about the ordering to consider to be sure you dont lose any symbols
  Each indexPair is <oldId, newId>
  @param listOfOldToNew