public ScramImage apply() {
        Map<ScramMechanism, Map<String, ScramCredentialData>> newMechanisms = new HashMap<>();
        for (Entry<ScramMechanism, Map<String, ScramCredentialData>> mechanismEntry : image.mechanisms().entrySet()) {
            newMechanisms.put(mechanismEntry.getKey(), new HashMap<>(mechanismEntry.getValue()));
        }
        for (Entry<ScramMechanism, Map<String, Optional<ScramCredentialData>>> mechanismChangeEntry : changes.entrySet()) {
            Map<String, ScramCredentialData> userMap =
                    newMechanisms.computeIfAbsent(mechanismChangeEntry.getKey(), __ -> new HashMap<>());
            for (Entry<String, Optional<ScramCredentialData>> userNameEntry : mechanismChangeEntry.getValue().entrySet()) {
                if (userNameEntry.getValue().isPresent()) {
                    userMap.put(userNameEntry.getKey(), userNameEntry.getValue().get());
                } else {
                    userMap.remove(userNameEntry.getKey());
                    if (userMap.isEmpty()) {
                        newMechanisms.remove(mechanismChangeEntry.getKey());
                    }
                }
            }
        }
        return new ScramImage(newMechanisms);
    }
Represents changes to a topic in the metadata image.
metadata/src/main/java/org/apache/kafka/image/ScramDelta.java