Utility method asSet - also testing Bamboo build.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@119764 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2015-12-08 11:21:30 +00:00
parent 7db3beea1e
commit 022bbcbde5
2 changed files with 28 additions and 0 deletions

View File

@@ -97,6 +97,24 @@ public final class RMCollectionUtils
}
}
/**
* Returns a Set containing all of the provided elements. Duplicate elements will be removed as per the
* {@code Set} contract.
*
* @param elements the elements to put in a Set.
* @param <T> the element type.
* @return a Set containing all the provided elements (without duplicates).
*/
public static <T> HashSet<T> asSet(T... elements)
{
final HashSet<T> set = new HashSet<>(elements.length);
for (T element : elements)
{
set.add(element);
}
return set;
}
/**
* This enum represents a change in an entry between 2 collections.
*/