static Set<Integer> calculateReassigningBrokers(Map<String, Map<Integer, PartitionMove>> moveMap) {
        Set<Integer> reassigningBrokers = new TreeSet<>();
        moveMap.values().forEach(partMoveMap -> partMoveMap.values().forEach(partMove -> {
            reassigningBrokers.addAll(partMove.sources);
            reassigningBrokers.addAll(partMove.destinations);
        }));
        return reassigningBrokers;
    }
Calculate all the brokers which are involved in the given partition reassignments.

@param moveMap       The partition movements.
@return              A set of all the brokers involved.
tools/src/main/java/org/apache/kafka/tools/reassign/ReassignPartitionsCommand.java