From 29e496b5ac7fbf61bf8a8ad3a4fb6c62944d0c81 Mon Sep 17 00:00:00 2001 From: nmcerlean Date: Tue, 12 Jan 2016 09:13:20 +0000 Subject: [PATCH] Some work on CaveatMark reading. --- .../util/RMCollectionUtils.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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. */