class SetUtils {
    
    

    public static Set<?> toSet(final Object target) {<FILL_FUNCTION_BODY>}

    
    
    public static int size(final Set<?> target) {
        Validate.notNull(target, "Cannot get set size of null");
        return target.size();
    }
    
    
    public static boolean isEmpty(final Set<?> target) {
        return target == null || target.isEmpty();
    }
    
    public static boolean contains(final Set<?> target, final Object element) {
        Validate.notNull(target, "Cannot execute set contains: target is null");
        return target.contains(element);
    }
    
    
    public static boolean containsAll(final Set<?> target, final Object[] elements) {
        Validate.notNull(target, "Cannot execute set containsAll: target is null");
        Validate.notNull(elements, "Cannot execute set containsAll: elements is null");
        return containsAll(target, Arrays.asList(elements));
    }
    
    
    public static boolean containsAll(final Set<?> target, final Collection<?> elements) {
        Validate.notNull(target, "Cannot execute set contains: target is null");
        Validate.notNull(elements, "Cannot execute set containsAll: elements is null");
        return target.containsAll(elements);
    }
    
    
    
    public static <X> Set<X> singletonSet(final X element) {
        final Set<X> set = new HashSet<X>(2, 1.0f);
        set.add(element);
        return Collections.unmodifiableSet(set);
    }
    
    
    private SetUtils() {
        super();
    }
    
    
}

        
        Validate.notNull(target, "Cannot convert null to set");
        
        if (target instanceof Set<?>) {
            return (Set<?>) target;
        }
        
        if (target.getClass().isArray()) {
            return new LinkedHashSet<Object>(Arrays.asList((Object[])target));
        }
        
        if (target instanceof Iterable<?>) {
            final Set<Object> elements = new LinkedHashSet<Object>();
            for (final Object element : (Iterable<?>)target) {
                elements.add(element);
            }
            return elements;
        }
        
        throw new IllegalArgumentException(
                "Cannot convert object of class \"" + target.getClass().getName() + "\" to a set");
        
    
<no_super_class>