public static Notifications of(Map<When, List<String>> emailAddressesByWhen, Map<When, List<Role>> emailRolesByWhen) {
        if (   emailAddressesByWhen.values().stream().allMatch(List::isEmpty)
            && emailRolesByWhen.values().stream().allMatch(List::isEmpty))
            return none;

        ImmutableMap.Builder<When, List<String>> emailAddresses = ImmutableMap.builder();
        emailAddressesByWhen.forEach((when, addresses) -> emailAddresses.put(when, List.copyOf(addresses)));

        ImmutableMap.Builder<When, List<Role>> emailRoles = ImmutableMap.builder();
        emailRolesByWhen.forEach((when, roles) -> emailRoles.put(when, List.copyOf(roles)));

        return new Notifications(emailAddresses.build(), emailRoles.build());
    }
Returns a new Notifications as specified by the given String input.

@param emailAddressesByWhen What email addresses to notify, indexed by when to notify them.
@param emailRolesByWhen What roles to infer email addresses for, and notify, indexed by when to notify them.
@return The Notifications as specified.
config-model-api/src/main/java/com/yahoo/config/application/api/Notifications.java