Return a new set with elements in the set that are not in the
        *iterables*.
516116
def difference(self, *iterables):
        
        diff = self._set.difference(*iterables)
        new_set = self.__class__(key=self._key, load=self._load, _set=diff)
        return new_set
372310
public static final <T> Set<Set<T>> powerSet(Set<T> set)
    {
        Set<Set<T>> powerSet = new HashSet<>();
        powerSet.add(Collections.EMPTY_SET);
        powerSet(powerSet, set);
        return powerSet;
    }
622615
public static <E> LinkedHashSet<E> newLinkedHashSet(Iterable<? extends E> elements) {
		if (elements instanceof Collection) {
			return new LinkedHashSet<E>((Collection<? extends E>)elements);
		}
		LinkedHashSet<E> set = newLinkedHashSet();
		for (E element : elements) {
			set.add(element);
		}
		return set;
	}
53081
public static <E> ArraySet<E> newArraySet(E... elements) {
        int capacity = elements.length * 4 / 3 + 1;
        ArraySet<E> set = new ArraySet<E>(capacity);
        Collections.addAll(set, elements);
        return set;
    }
1277679
def from_iterable(cls, iterable: Iterable) -> 'List':
        """"""

        iterator = iter(iterable)

        def recurse() -> List:
            try:
                value = next(iterator)
            except StopIteration:

                return List.empty()
            return List.unit(value).append(recurse())
        return List.empty().append(recurse())
104066
public static <T> Set<T> toSet(Iterable<T> iterable)
   {
      if (iterable == null)
      {
         return null;
      }
      else if (iterable instanceof Set)
      {
         return (Set<T>) iterable;
      }
      else
      {
         Set<T> list = new LinkedHashSet<>();
         for (T obj : iterable)
         {
            list.add(obj);
         }
         return list;
      }
   }
1204271
public static <E> HashSet<E> newHashSet(Iterable<? extends E> elements) {
		return (elements instanceof Collection) ? new HashSet<E>((Collection<? extends E>)elements)
				: newHashSet(elements.iterator());
	}
413054
def remove_subset(set_, subset):
    
    ensure_set(set_)
    ensure_iterable(subset)

    for elem in subset:
        set_.remove(elem)
68246
def powerset(l):
    
    return chain.from_iterable(combinations(l, r) for r in range(len(l)+1))
152516
public Set<E> getSubSet(int k) {
        int from = -1;
        //TODO: very bad. Bounds should be memorized
        for (int x = 0; x < values.size(); x++) {
            int cIdx = index.get(values.get(x).id());
            if (cIdx == k && from == -1) {
                from = x;
            }
            if (from >= 0 && cIdx > k) {
                return new ElementSubSet<>(this, k, from, x);
            }
        }
        if (from >= 0) {
            return new ElementSubSet<>(this, k, from, values.size());
        }
        return Collections.emptySet();
    }
1239154
def difference(self, *other):
        
        from_frozenset = self.items.difference(*map(set, other))
        return self.from_iterable(from_frozenset, sort=True)
239265
public static <T> Set<T> newUnmodifiableSet(T...contents)
	{
		Set<T> set;

		if(contents == null || contents.length==0)
			return Collections.emptySet();
		if(contents.length == 1)
			return Collections.singleton(contents[0]);
		set = newSet(contents.length);
		Collections.addAll(set, contents);
		return Collections.unmodifiableSet(set);
	}
845481
def element(self, inp=None):
        
        for set in self.sets:
            try:
                return set.element(inp)
            except NotImplementedError:
                pass
        raise NotImplementedError('`element` not implemented for any of the '
                                  'subsets')
158319
public static <T> HashSet<T> newHashSet(Iterable<? extends T> elements) {
		return Sets.newHashSet(elements);
	}
960518
def uniqued(iterable):
    
    seen = set()
    return [item for item in iterable if item not in seen and not seen.add(item)]
601747
def unique(iterable):
    
    seen = set()
    return [x for x in iterable if x not in seen and not seen.add(x)]
1161265
public static <T> Set<T> iterableToSet(Iterable<T> iterable) {
        if (iterable == null) {
            return Collections.emptySet();
        }
        if (iterable instanceof Set) {
            return (Set<T>) iterable;
        }
        Iterator<T> i = iterable.iterator();
        if (i.hasNext()) {
            Set<T> list = new HashSet<>();
            while (i.hasNext()) {
                list.add(i.next());
            }
            return list;
        }
        return Collections.emptySet();
    }