Return a new set with elements common to the set and all others.
484676
def intersection(self, key, *others):
        """"""
        if not isinstance(key, str):
            raise ValueError("String expected.")
        self.db.sinterstore(key, [self.key] + [o.key for o in others])
        return Set(key)
283936
def sets(self):
        """"""
        sets = {}
        for x in self._parents:
            sets.setdefault(self[x], set()).add(x)
        return frozenset(frozenset(v) for v in six.viewvalues(sets))
1180476
public static <T> Set<T> union(Collection<Set<T>> sets) {
		Set<T> result = new HashSet<>();
		if (sets.isEmpty()) {
			return result;
		}
		Iterator<Set<T>> iter = sets.iterator();
		result.addAll(iter.next());

		if (sets.size() == 1) {
			return result;
		}

		while (iter.hasNext()) {
			result.addAll(iter.next());
		}
		return result;
	}
1264047
def add_set(self):
        
        self.__label_counter += 1
        new_label = self.__label_counter
        self.__forest[new_label] = -1  # All new sets have their parent set to themselves
        self.__set_counter += 1
        return new_label
698883
function makeSet( length ) {
    var res = new Array( length );
    var i = -1;

    while( ++i < length ) {
        res[i] = i;
    }

    return new _set2.default( res );
}
197777
function set() {
    function Set() {}
    var ret = new Set();
    var arg, i, len;

    for(i = 0, len = arguments.length; i < len; i++) {
        arg = arguments[i];

        if(arg.constructor.name == 'Set') Object.keys(arg).filter(
            not(prop.bind(undefined, ret))
        ).forEach(addElem.bind(undefined, ret));
        else if(!(arg in ret)) addElem(ret, arg);
    }

    return Object.preventExtensions(ret);
}
384252
public static <T> HashSet<T> newHashSet(Collection<T> collection) {
		return newHashSet(false, collection);
	}
438310
def visit_set(self, node, parent):
        """"""
        newnode = nodes.Set(node.lineno, node.col_offset, parent)
        newnode.postinit([self.visit(child, newnode) for child in node.elts])
        return newnode
368583
def unique(iterable):
    """"""
    seen = set()
    for item in iterable:
        if item not in seen:
            seen.add(item)
            yield item
1065653
Set<E> union(final SmallSet<E> s) {
        if ((s.e1 == e1 && s.e2 == e2) || (s.e1 == e2 && s.e2 == e1)) {
            return this; // if the two sets are equal, return this
        }
        if (s.e1 == null) {
            return this; // if s is empty, return this
        }
        if (e1 == null) {
            return s; // if this is empty, return s
        }
        if (s.e2 == null) { // s contains exactly one element
            if (e2 == null) {
                return new SmallSet<E>(e1, s.e1); // necessarily e1 != s.e1
            } else if (s.e1 == e1 || s.e1 == e2) { // s is included in this
                return this;
            }
        }
        if (e2 == null) { // this contains exactly one element
            // if (s.e2 == null) { // cannot happen
            // return new SmallSet(e1, s.e1); // necessarily e1 != s.e1
            // } else
            if (e1 == s.e1 || e1 == s.e2) { // this in included in s
                return s;
            }
        }
        // here we know that there are at least 3 distinct elements
        HashSet<E> r = new HashSet<E>(4);
        r.add(e1);
        if (e2 != null) {
            r.add(e2);
        }
        r.add(s.e1);
        if (s.e2 != null) {
            r.add(s.e2);
        }
        return r;
    }
597371
public static <E extends Enum<E>> StreamableEnumSet<E> copyOf (Collection<E> s)
    {
        if (s instanceof StreamableEnumSet<?>) {
            StreamableEnumSet<E> set = (StreamableEnumSet<E>)s;
            return copyOf(set);
        }
        if (s.isEmpty()) {
            throw new IllegalArgumentException("Collection must have at least one element.");
        }
        StreamableEnumSet<E> set = new StreamableEnumSet<E>(
            s.iterator().next().getDeclaringClass());
        set.addAll(s);
        return set;
    }
1328136
@NonNull
  public static <E> ImmutableSet<E> concatSet(
      @NonNull ImmutableSet<E> set, @NonNull Iterable<E> toConcat) {
    return ImmutableSet.<E>builder().addAll(set).addAll(toConcat).build();
  }
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
923189
public static IntSet and (IntSet... sets)
    {
        checkNotNull(sets);
        IntSet result = create();
        int len = sets.length;
        if (len > 0) {
            OUTER:
            for (Interator it = sets[0].interator(); it.hasNext(); ) {
                int val = it.nextInt();
                for (int ii = 1; ii < len; ii++) {
                    if (!sets[ii].contains(val)) {
                        continue OUTER;
                    }
                }
                result.add(val);
            }
        }
        return result;
    }
362243
public static <T> Set<T> intersection(Set<T> setA, Set<T> setB) {
        Set<T> intersection = new HashSet<T>(setA);
        intersection.retainAll(setB);
        return intersection;
    }
859866
def combine_sets(*sets):
    
    combined = set()
    for s in sets:
        combined.update(s)
    return combined
60676
function createSet(values) {
    var set = new Set();
    Lazy(values || []).flatten().each(function(e) {
      set.add(e);
    });
    return set;
  }