public static AssignReplicasToDirsResponseData normalize(AssignReplicasToDirsResponseData response) {
        response = response.duplicate();
        response.directories().sort(Comparator.comparing(AssignReplicasToDirsResponseData.DirectoryData::id));
        for (AssignReplicasToDirsResponseData.DirectoryData directory : response.directories()) {
            directory.topics().sort(Comparator.comparing(AssignReplicasToDirsResponseData.TopicData::topicId));
            for (AssignReplicasToDirsResponseData.TopicData topic : directory.topics()) {
                topic.partitions().sort(Comparator.comparing(AssignReplicasToDirsResponseData.PartitionData::partitionIndex));
            }
        }
        return response;
    }
Normalize the response data by sorting the directories, topics and partitions.
This is useful for comparing two semantically equivalent requests.
server-common/src/main/java/org/apache/kafka/metadata/AssignmentsHelper.java