public void freeze() {
        if (frozen) return;
        for (FieldValues fieldValues : fieldValuesByName.values())
            fieldValues.freeze();
        fieldValuesByName = Map.copyOf(fieldValuesByName);
        inheritedProfiles.freeze();

        Collections.sort(variants);
        for (QueryProfileVariant variant : variants)
            variant.freeze();
        variants = List.copyOf(variants);

        frozen=true;
    }
Irreversibly prevents any further modifications to this
container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileVariants.java