Creates a new set that contains the items that are in current set that
are also contained in the provided set.

Formally:
A ∩ B = {x : x ∈ A ∧ x ∈ B}

@param Set $that
@return Set
439431
function intersection(Set $that) {
        $intersection = $this->cloneEmpty();

        $this->addIf($intersection, $this, [$that, 'has']);

        return $intersection;
    }
400579
public <T> boolean containsAny(Set<T> set, Collection<T> other) {
        for (T t : other) {
            if (set.contains(t)) {
                return true;
            }
        }
        return false;
    }
499043
public Set<Map.Entry<A,B>> entrySet() {
	return new AbstractSet<Map.Entry<A,B>>() {
	    public int size() {
		return map.size();
	    }
	    public Iterator<Map.Entry<A,B>> iterator() {
		return new Iterator<Map.Entry<A,B>>() {
		    private final Iterator<Map.Entry<A,B>> it = map.entrySet().iterator();
		    private Map.Entry<A,B> last = null;
		    public boolean hasNext() {
			return it.hasNext(); 
		    }
		    public Map.Entry<A,B> next() { 
		        last = it.next();
			return last;
		    }
		    public void remove() {
			it.remove();
			revMap.remove(last.getValue());
		    }
		};
	    }
	    public boolean remove(Object o) {
		if(!(o instanceof Map.Entry/*<A,B>*/)) return false;
		@SuppressWarnings("unchecked")
		Map.Entry<A,B> entry = (Map.Entry<A,B>) o;
		B currValue = BijMap.this.get(entry.getKey());
		if((currValue == null) || !currValue.equals(entry.getValue())) return false;
		BijMap.this.remove(entry.getKey());
		return true;
	    }
	    public void clear() {
		BijMap.this.clear();
	    }
	};
    }
1051360
public static <E> Set<E> intersection(Set<E> s1, Set<E> s2) {
    Set<E> s = new HashSet<E>();
    s.addAll(s1);
    s.retainAll(s2);
    return s;
  }
831993
public function toASN1(): Set
    {
        $elements = array_map(
            function (Attribute $attr) {
                return $attr->toASN1();
            }, array_values($this->_attributes));
        $set = new Set(...$elements);
        return $set->sortedSetOf();
    }
89165
public function set($number)
    {
        $this->setCurrentValue($number);
        $this->currentOperation = 'add';
        $this->addToHistory('set', $number);
        return $this;
    }
1076514
public static function instance( $set = null ) 
	{
		if ( is_null( $set ) ) 
		{
			return static::$_instance;
		}
		
		if ( !$set instanceof CCIn_Instance ) 
		{
			throw new \InvalidArgumentException('CCIn::set() - only CCIn_Instance object can be passed.');
		}
		
		static::$_instance = $set;
	}
252775
public static <T> Set<T> intersection(Set<T>... sets) {
		return intersection(Arrays.asList(sets));
	}
848606
public function union(Set $set): Set
    {
        $union = new self();

        foreach ($this as $value) {
            $union->add($value);
        }

        foreach ($set as $value) {
            $union->add($value);
        }

        return $union;
    }
233645
public function createContains(): \Contains
    {
        $num = array_push($this->contains, new Contains());

        return $this->contains[$num - 1];
    }
1112224
public function swap($a, $b)
    {
        $oldA = $this->get($a);
        $oldB = $this->get($b);

        $this->set($a, $oldB);
        $this->set($b, $oldA);

        return $this;
    }
132018
public function multipliedBy($that) : RationalMoney
    {
        $amount = $this->amount->multipliedBy($that);

        return new self($amount, $this->currency);
    }
609707
public static function overwrite(array $set1, array $set2) {
        $overwrite = array_intersect_key($set2, $set1);

        if ($overwrite) {
            foreach ($overwrite as $key => $value) {
                if (is_array($value)) {
                    $set1[$key] = static::overwrite($set1[$key], $value);
                } else {
                    $set1[$key] = $value;
                }
            }
        }

        return $set1;
    }
484086
public static <A, B> These<A, B> b(B b) {
        return new _B<>(b);
    }
203167
public static <T> Set<T> subSet(Set<T> original, int from, int to) {
        List<T> list = new ArrayList<>(original);
        if (to == -1) {
            to = original.size();
        }
        return new LinkedHashSet<>(list.subList(from, to));
    }
245673
public function union(Value $set)
    {
        $union = $this->value;

        /** @var Value $arg */
        foreach (func_get_args() as $arg) {
            /** @var array $convertedArg */
            $convertedArg = $arg->getSet()->getValue();
            $union = array_merge($union, array_diff($convertedArg, $union));
        }

        return new self($union);
    }
1320736
public function set(array $set)
    {
        foreach ($set as $loader => $fields) {
            $this->loader($loader)->fields($fields);
        }

        // Disable
        $this->contextLoader = false;

        return $this;
    }