public static void filterCells(WALEdit edit, Function<Cell, Cell> mapper) {
    ArrayList<Cell> cells = edit.getCells();
    int size = cells.size();
    int newSize = 0;
    for (int i = 0; i < size; i++) {
      Cell cell = mapper.apply(cells.get(i));
      if (cell != null) {
        cells.set(newSize, cell);
        newSize++;
      }
    }
    for (int i = size - 1; i >= newSize; i--) {
      cells.remove(i);
    }
    if (newSize < size / 2) {
      cells.trimToSize();
    }
  }
Public because of FSHLog. Should be package-private
@param isRecoverEdits the created writer is for recovered edits or WAL. For recovered edits, it
                      is true and for WAL it is false.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALUtil.java