Returns the popcount or cardinality of the intersection of the two sets.
Neither set is modified.
498284
public static long intersectionCount(OpenBitSet a, OpenBitSet b) {
        return BitUtil.pop_intersect( a.bits, b.bits, 0, Math.min( a.wlen, b.wlen ) );
    }
315340
def intersection(self,other):
        
        if self.everything:
            if other.everything:
                return DiscreteSet()
            else:
                return DiscreteSet(other.elements)
        else:
            if other.everything:
                return DiscreteSet(self.elements)
            else:
                return DiscreteSet(self.elements.intersection(other.elements))
667666
public static <E> Set<E> intersection(Set<E> first, Set<E> second) {
        if (first == null || second == null) {
            return EMPTY_SET;
        }

        Set<E> intersection = new HashSet<>();

        for (E e : first) {
            if (second.contains(e)) {
                intersection.add(e);
            }
        }
        return intersection;
    }
1302192
def intersection(other)
      if other.is_a?(AbsoluteSet) and other.universe.eql?(@universe)
        copy(:mask => @mask & other.mask)
      elsif other.is_a?(AbstractSet) and other.infinite?
        other.intersection(self)
      else
        copy(:mask => @mask & as_mask(other, false))
      end
    end
605565
def intersection(self, other):
        
        #NOTE: This is a work around 
        # Python 3 return as the result of set.intersection a new set instance.
        # Python 2 however returns as a the result a ClusterShell.RangeSet.RangeSet instance.
        # ORIGINAL CODE: return self._wrap_set_op(set.intersection, other)
        copy = self.copy()
        copy.intersection_update(other)
        return copy
1345541
public static <T> Set<T> intersection(Collection<Set<T>> sets) {
		Set<T> result = new HashSet<>();
		if (sets.isEmpty()) {
			return result;
		}
		Iterator<Set<T>> iter = sets.iterator();
		result.addAll(iter.next());
		while (iter.hasNext()) {
			result.retainAll(iter.next());
		}
		return result;
	}
666582
public static <T> Collection<T> intersection(Collection<T> coll1, Collection<T> coll2) {
		final ArrayList<T> list = new ArrayList<>();
		if (isNotEmpty(coll1) && isNotEmpty(coll2)) {
			final Map<T, Integer> map1 = countMap(coll1);
			final Map<T, Integer> map2 = countMap(coll2);
			final Set<T> elts = newHashSet(coll2);
			int m;
			for (T t : elts) {
				m = Math.min(Convert.toInt(map1.get(t), 0), Convert.toInt(map2.get(t), 0));
				for (int i = 0; i < m; i++) {
					list.add(t);
				}
			}
		}
		return list;
	}
208087
public int cardinality() {
		int sum = 0;
		for (int i = 0; i < wordsInUse; i++)
			sum += Long.bitCount(words[i]);
		return sum;
	}
1094265
public static <E> Set<E> intersectionView(final Set<E> set1, final Set<?> set2) {
		return Sets.intersection(set1, set2);
	}
718932
def cardinality(self):
        
        data = clips.data.DataObject(self._env)

        lib.EnvDeftemplateSlotCardinality(
            self._env, self._tpl, self._name, data.byref)

        return tuple(data.value) if isinstance(data.value, list) else ()
1038661
public static IntSet difference (IntSet set1, IntSet set2)
    {
        return and(set1, notView(set2));
    }
1220844
function (other) {
        assertNotNull(other);

        // intersection of anything with empty set is empty set, so return if count is 0
        if (this.count() === 0) {
            return;
        }

        var c = collectionCount(other);

        if (c !== -1) {
            if (c === 0) {
                this.clear();
                return;
            }

            // If other is a HashSet, it has unique elements according to its equality comparer,
            // but if they're using different equality comparers, then assumption of uniqueness
            // will fail. So first check if other is a hashset using the same equality comparer;
            // intersect is a lot faster if we can assume uniqueness.

            if (areEqualityComparersEqual(this, other)) {
                var arr = this.table.entries(true),
                    item;

                c = this.count();

                while (c-- > 0) {
                    item = arr[c];
                    if (!other.contains(item)) {
                        this.table.remove(item);
                    }
                }

                return;
            }
        }

        this.intersectWith(new HashSet(other, this.compare));
    }
1184467
public Range<T> intersectionWith(Range<T> other) {
    if (!this.isOverlappedBy(other)) { throw new IllegalArgumentException(String.format(
        "Cannot calculate intersection with non-overlapping range %s", other)); }
    if (this.equals(other)) { return this; }
    T min = this.comparator.compare(this.min, other.min) < 0 ? other.min : this.min;
    T max = this.comparator.compare(this.max, other.max) < 0 ? this.max : other.max;
    return between(min, max, this.comparator);
  }
792105
public final int popAndTop()
  {

    m_firstFree--;

    m_map[m_firstFree] = DTM.NULL;

    return (m_firstFree == 0) ? DTM.NULL : m_map[m_firstFree - 1];
  }
711441
def intersection(self, other):
        
        if isinstance(other, self.__class__):
            return self.client.sinter([self.name, other.name])
        else:
            return self._as_set().intersection(other)
1154539
public static boolean existPairwiseIntersections(Collection<Set<String>> sets) {
		// Determine all possible pairs of sets
		List<List<Set<String>>> setPairs = ListUtils.getKElementaryLists(new ArrayList<Set<String>>(sets), 2);
		for (Iterator<List<Set<String>>> iter = setPairs.iterator(); iter.hasNext();) {
			Set<String> intersection = SetUtils.intersection(iter.next());
			if (!intersection.isEmpty()) {
				return true;
			}
		}
		return false;
	}
18424
def python_cardinality(self, subject: str, all_are_optional: bool = False) -> str:
        
        if self.multiple_elements:
            rval = f"typing.List[{subject}]"
        elif self.one_optional_element:
            rval = subject if subject.startswith("typing.Optional[") else f"typing.Optional[{subject}]"
        elif self.max == 0:
            rval = "type(None)"
        else:
            rval = subject
        if all_are_optional and not self.one_optional_element:
            rval = f"typing.Optional[{rval}]"
        return rval