class ImageCatalogVersionFilter {

    public Set<CloudbreakVersion> filterUnreleasedVersions(Collection<CloudbreakVersion> cloudbreakVersions, String unReleasedVersion) {
        Map<Boolean, List<CloudbreakVersion>> partitionedVersions = cloudbreakVersions.stream()
                .collect(Collectors.partitioningBy(containsNonReleaseVersion(unReleasedVersion)));
        if (hasFiltered(partitionedVersions)) {
            LOGGER.debug("Used filter unReleasedVersion: | {} | Versions filtered: {}",
                    unReleasedVersion,
                    partitionedVersions.get(false).stream()
                            .map(CloudbreakVersion::getVersions).flatMap(List::stream)
                            .collect(Collectors.joining(", ")));
        }
        return new HashSet<>(partitionedVersions.get(true));
    }

}