public static ImportResult merge(ImportResult ir1, ImportResult ir2) {
    if (ir1.getType() == ResultType.ERROR) {
      return ir1;
    }
    if (ir2.getType() == ResultType.ERROR) {
      return ir2;
    }
    ImportResult res = new ImportResult(ResultType.OK);
    res.bytes = Stream.of(ir1.getBytes(), ir2.getBytes())
        .filter(Optional::isPresent)
        .map(Optional::get)
        .reduce(Long::sum);
    res.counts = mergeCounts(ir1, ir2);
    return res;
  }
Returns a new result that's a combination of the two given results.
portability-spi-transfer/src/main/java/org/datatransferproject/spi/transfer/provider/ImportResult.java