@Nonnull
    public static <V> Set<V> findDuplicates(@Nonnull final Collection<V>... collections)
    {
        final Set<V> merged = new HashSet<>();
        final Set<V> duplicates = new HashSet<>();
        for (Collection<V> collection : collections) {
            for (V o : collection) {
                if (!merged.add(o)) {
                    duplicates.add(o);
                }
            }
        }
        return duplicates;
    }
Returns all elements that occur more than exactly once in the combination of all elements from all provided
collections.

@param collections The collection for which to return duplicates
@param <V> The type of the entities in the collections.
@return The duplicates
xmppserver/src/main/java/org/jivesoftware/util/CollectionUtils.java