class WorkItemDefinitionRegistries {

    @SuppressWarnings("all")
    public void clear() {
        registryMap.values().stream()
                .collect(Collectors.toList())
                .forEach(registryDestroyer);
        registryMap.clear();
    }

    public  WorkItemDefinitionRegistries(final Function<T, String> keyProvider,
                                        final Map<String, WorkItemDefinitionCacheRegistry> registryMap,
                                        final Consumer<WorkItemDefinitionCacheRegistry> registryDestroyer);

}