private static Optional<Map<String, Integer>> mergeCounts(ImportResult ir1, ImportResult ir2) {
    if (ir1.counts.isPresent() && ir2.counts.isPresent()) {
      Map<String, Integer> map = new HashMap<>(ir1.counts.get());
      ir2.counts.get().forEach((k, v) -> map.merge(k, v, Integer::sum));
      return Optional.of(map);
    } else {
      return ir1.counts.isPresent() ? ir1.counts : ir2.counts;
    }
  }
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