public static Map<Integer, Uuid> createAssignmentMap(int[] replicas, Uuid[] directories) {
        if (replicas.length != directories.length) {
            throw new IllegalArgumentException("The lengths for replicas and directories do not match.");
        }
        Map<Integer, Uuid> assignments = new HashMap<>();
        for (int i = 0; i < replicas.length; i++) {
            int brokerId = replicas[i];
            Uuid directory = directories[i];
            if (assignments.put(brokerId, directory) != null) {
                throw new IllegalArgumentException("Duplicate broker ID in assignment");
            }
        }
        return assignments;
    }
Build a mapping from replica to directory based on two lists of the same size and order.
@param replicas                      The replicas, represented by the broker IDs
@param directories                   The directory information
@return                              A map, linking each replica to its assigned directory
@throws IllegalArgumentException     If replicas and directories have different lengths,
                                     or if there are duplicate broker IDs in the replica list
server-common/src/main/java/org/apache/kafka/common/DirectoryId.java