public FeaturesImage apply() {
        Map<String, Short> newFinalizedVersions =
            new HashMap<>(image.finalizedVersions().size());
        for (Entry<String, Short> entry : image.finalizedVersions().entrySet()) {
            String name = entry.getKey();
            Optional<Short> change = changes.get(name);
            if (change == null) {
                newFinalizedVersions.put(name, entry.getValue());
            } else if (change.isPresent()) {
                newFinalizedVersions.put(name, change.get());
            }
        }
        for (Entry<String, Optional<Short>> entry : changes.entrySet()) {
            String name = entry.getKey();
            Optional<Short> change = entry.getValue();
            if (!newFinalizedVersions.containsKey(name)) {
                if (change.isPresent()) {
                    newFinalizedVersions.put(name, change.get());
                }
            }
        }

        final MetadataVersion metadataVersion;
        if (metadataVersionChange == null) {
            metadataVersion = image.metadataVersion();
        } else {
            metadataVersion = metadataVersionChange;
        }

        final ZkMigrationState zkMigrationState;
        if (zkMigrationStateChange == null) {
            zkMigrationState = image.zkMigrationState();
        } else {
            zkMigrationState = zkMigrationStateChange;
        }
        return new FeaturesImage(newFinalizedVersions, metadataVersion, zkMigrationState);
    }
Represents changes to the cluster in the metadata image.
metadata/src/main/java/org/apache/kafka/image/FeaturesDelta.java