public List<String> deleteUnused(
            final List<String> duplicateStoreUuids,
            final List<AnalyticRuleDoc> analytics) {
        final List<String> deletedUuids = new ArrayList<>();
        try {
            LOGGER.debug(() -> LogUtil.message(
                    "deleteUnused() - duplicateStoreUuids.size: {}, analytics.size: {}",
                    NullSafe.size(duplicateStoreUuids), NullSafe.size(analytics)));
            if (NullSafe.hasItems(duplicateStoreUuids)) {
                final List<String> redundantDupStoreUuids;
                if (NullSafe.hasItems(analytics)) {
                    final Set<String> analyticUuids = analytics.stream()
                            .filter(Objects::nonNull)
                            .map(AnalyticRuleDoc::getUuid)
                            .filter(Objects::nonNull)
                            .collect(Collectors.toSet());
                    // Find dup stores with no corresponding analytic
                    redundantDupStoreUuids = duplicateStoreUuids.stream()
                            .filter(uuid -> !analyticUuids.contains(uuid))
                            .toList();
                } else {
                    // No analytics so all redundant
                    redundantDupStoreUuids = duplicateStoreUuids;
                }

                // Delete unused duplicate stores.
                redundantDupStoreUuids.stream()
                        .map(this::deleteDuplicateStore)
                        .filter(Optional::isPresent)
                        .map(Optional::get)
                        .forEach(deletedUuids::add);

                if (!deletedUuids.isEmpty()) {
                    LOGGER.info("Deleted {} redundant duplicate check stores", deletedUuids.size());
                }
            }
        } catch (final RuntimeException e) {
            LOGGER.error(e::getMessage, e);
        }
        // Return this to ease testing
        return deletedUuids;
    }
Get a list of duplicate checking store UUID names that currently exist.

@return A list of duplicate checking store UUID names that currently exist.
stroom-analytics/stroom-analytics-impl/src/main/java/stroom/analytics/impl/DuplicateCheckDirs.java