diff --git a/rm-community/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java b/rm-community/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java index a5565d9855..1d3652170c 100644 --- a/rm-community/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java +++ b/rm-community/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/RMCollectionUtils.java @@ -21,6 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.util; import static org.springframework.util.ObjectUtils.nullSafeEquals; import java.util.ArrayList; +import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -116,6 +117,22 @@ public final class RMCollectionUtils return set; } + /** + * Returns a Set containing all of the elements in the provided collection. + * Duplicate elements will be removed as per the + * {@code Set} contract. + * + * @param c the elements to put in a Set. + * @param the element type. + * @return a Set containing all the provided elements (without duplicates). + */ + public static HashSet asSet(Collection c) + { + final HashSet set = new HashSet<>(); + set.addAll(c); + return set; + } + /** * This enum represents a change in an entry between 2 collections. */