final Collection<TaskDto> otherTasks = otherSource.getAllTasks();
final Collection<TaskDto> exchangeTasks = exchangeSource.getAllTasks();
final Map<String, TaskDto> otherTasksMap = generateExchangeIdMap(otherTasks);
final Map<String, TaskDto> exchangeTasksMap = generateExchangeIdMap(exchangeTasks);
for (final TaskDto exchangeTask : exchangeTasks) {
final TaskDto otherTask = otherTasksMap.get(exchangeTask.getExchangeId());
results.add(new Pair<TaskDto, TaskDto>(exchangeTask, otherTask));
}
for (final TaskDto otherTask : otherTasks) {
final TaskDto exchangeTask = exchangeTasksMap.get(otherTask.getExchangeId());
results.add(new Pair<TaskDto, TaskDto>(exchangeTask, otherTask));
}
return results;
}