void (@NotNull ProductivityFeaturesProvider provider) { Class<? extends ProductivityFeaturesProvider> providerClass = provider.getClass(); Set<String> featureIdsToRemove = myFeatures.entrySet().stream() .filter(entry -> entry.getValue().getProvider() == providerClass) .map(entry -> entry.getKey()) .collect(Collectors.toSet()); featureIdsToRemove.forEach(id -> myFeatures.remove(id)); myActionEvents.removeIf(event -> featureIdsToRemove.contains(event.featureId())); myIntentionEvents.removeIf(event -> featureIdsToRemove.contains(event.featureId())); myApplicabilityFilters.removeIf(data -> data.provider == provider); LOG.info("Removed features provided by " + providerClass.getName() + ": " + featureIdsToRemove); }