code: public static List<Cell> deduplicateFamily(Mutation mutation, byte[] family) {
      List<Cell> result = new LinkedList<>();
      Map<QualifierOnlyKey, Cell> latestCells = new HashMap<>();
      List<Cell> familyCells = mutation.getFamilyCellMap().get(family);
      if (familyCells == null || family.length == 0) {
        return new LinkedList<>();
      }
      for (Cell cell : familyCells) {
        QualifierOnlyKey key = new QualifierOnlyKey(CellUtil.cloneQualifier(cell));
        latestCells.put(key, cell);
      }
      result.addAll(latestCells.values());
      return result;
    }
docs: Given a Mutation and a family with potentially duplicate cell family:qualifier combinations,
  remove all entries except for the last for that family:qualifier pair.
  
  @param mutation a {@link org.apache.hadoop.hbase.client.Mutation} object.
  @param family an array of byte.
  @return a {@link java.util.List} object.