(see AbstractSet#intersection)
359350
def intersection(other)
      if other.is_a?(RelativeComplement)
        # A ∩ ¬B = ¬B ∩ A
        other.intersection(self)
      elsif other.is_a?(AbstractSet)
        if other.is_a?(RelativeSet) and size > other.size
          # For efficiency, iterate the smaller of the two sets: A ∩ B = B ∩ A
          other.intersection(self)
        elsif other.empty?
          # A ∩ ∅ = ∅
          NullSet.build
        else
          hash = @hash.clone.delete_if{|o,_| not other.include?(o) }

          if hash.empty?
            NullSet.build
          else
            RelativeSet.new(hash)
          end
        end
      else
        intersection(Cantor.build(other))
      end
    end
685148
@Override
    public R visitIntersection(IntersectionType t, P p) {
        return visitUnknown(t, p);
    }
976874
public static <E> boolean intersects(Set<E> s1, Set<E> s2) {
    // loop over whichever set is smaller
    if (s1.size() < s2.size()) {
      for (E element1 : s1) {
        if (s2.contains(element1)) {
          return true;
        }
      }
    } else {
      for (E element2 : s2) {
        if (s1.contains(element2)) {
          return true;
        }
      }
    }
    
    return false;
  }
1200866
public static final <T> Set<T> intersection(Collection<Set<T>> sets)
    {
        Set<T> set = union(sets);
        for (Set<T> s : sets)
        {
            set.retainAll(s);
        }
        return set;
    }
856915
def intersection(self, other):
    

    # we only deal with the case of two lists here
    length1 = len(self)
    length2 = len(other)

    # initialize list of output segments
    ostart = -1
    outlist = []
    iseg2 = -1
    start2 = -1
    stop2 = -1

    for seg1 in self:
      start1 = seg1.start()
      stop1 = seg1.end()
      id = seg1.id()

      # loop over segments from the second list which overlap this segment
      while start2 < stop1:
        if stop2 > start1:
          # these overlap

          # find the overlapping range
          if start1 < start2:
            ostart = start2
          else:
            ostart = start1
          if stop1 > stop2:
            ostop = stop2
          else:
            ostop = stop1

          x = ScienceSegment(tuple([id, ostart, ostop, ostop-ostart]))
          outlist.append(x)

          if stop2 > stop1:
            break

        # step forward
        iseg2 += 1
        if iseg2 < len(other):
          seg2 = other[iseg2]
          start2 = seg2.start()
          stop2 = seg2.end()
        else:
          # pseudo-segment in the far future
          start2 = 2000000000
          stop2 = 2000000000

    # save the intersection and return the length
    self.__sci_segs = outlist
    return len(self)
160457
def coords_intersect(self):
        
        return set.intersection(*map(
            set, (getattr(arr, 'coords_intersect', arr.coords) for arr in self)
            ))
1135948
function intersection( arr1, arr2 ){
	var rtn = [];

	if ( arr1.length > arr2.length ){
		let t = arr1;

		arr1 = arr2;
		arr2 = t;
	}

	for( let i = 0, c = arr1.length; i < c; i++ ){
		let d = arr1[i];

		if ( arr2.indexOf(d) !== -1 ){
			rtn.push( d );
		}
	}

	return rtn;
}
693067
static boolean intersect(int[] verts, int a, int b, int c, int d) {
        if (intersectProp(verts, a, b, c, d))
            return true;
        else if (between(verts, a, b, c) || between(verts, a, b, d) || between(verts, c, d, a)
                || between(verts, c, d, b))
            return true;
        else
            return false;
    }
624800
public static final <T> boolean intersect(Collection<Set<T>> sets)
    {
        Set<T> set = intersection(sets);
        return !set.isEmpty();
    }
91270
public AsciiSet intersection(AsciiSet set) {
    final boolean[] intersectionMembers = new boolean[128];
    for (int i = 0; i < intersectionMembers.length; ++i) {
      intersectionMembers[i] = members[i] && set.members[i];
    }
    return new AsciiSet(intersectionMembers);
  }
564012
public static final boolean intersection(Rectangle src1, Rectangle src2, Rectangle dest)
    {
        int x1 = Math.max(src1.x, src2.x);
        int y1 = Math.max(src1.y, src2.y);
        int x2 = Math.min(src1.x + src1.width, src2.x + src2.width);
        int y2 = Math.min(src1.y + src1.height, src2.y + src2.height);
        dest.setBounds(x1, y1, x2 - x1, y2 - y1);

        if (dest.width <= 0 || dest.height <= 0)
            return false;

        return true; // non-empty intersection
    }
700867
public void intersectionWith(Multiset<O> multiset) throws ParameterException {
		Validate.notNull(multiset);
		for (O o : support()) {
			if (multiset.multiplicity(o) > 0) {
				setMultiplicity(o, Math.min(multiplicity(o), multiset.multiplicity(o)));
			} else {
				remove(o);
			}
		}
	}
506465
def intersection(self, other: 'FileLineSet') -> 'FileLineSet':
        
        assert isinstance(other, FileLineSet)
        set_self = set(self)
        set_other = set(other)
        set_union = set_self & set_other
        return FileLineSet.from_list(list(set_union))
1094265
public static <E> Set<E> intersectionView(final Set<E> set1, final Set<?> set2) {
		return Sets.intersection(set1, set2);
	}
468819
def intersection_update(self, other):
        """"""
        return self.client.sinterstore(self.name, [self.name, other.name])
272278
public List<Type> intersect(List<Type> cl1, List<Type> cl2) {
        if (cl1 == cl2)
            return cl1;
        if (cl1.isEmpty() || cl2.isEmpty())
            return List.nil();
        if (cl1.head.tsym.precedes(cl2.head.tsym, this))
            return intersect(cl1.tail, cl2);
        if (cl2.head.tsym.precedes(cl1.head.tsym, this))
            return intersect(cl1, cl2.tail);
        if (isSameType(cl1.head, cl2.head))
            return intersect(cl1.tail, cl2.tail).prepend(cl1.head);
        if (cl1.head.tsym == cl2.head.tsym &&
            cl1.head.hasTag(CLASS) && cl2.head.hasTag(CLASS)) {
            if (cl1.head.isParameterized() && cl2.head.isParameterized()) {
                Type merge = merge(cl1.head,cl2.head);
                return intersect(cl1.tail, cl2.tail).prepend(merge);
            }
            if (cl1.head.isRaw() || cl2.head.isRaw())
                return intersect(cl1.tail, cl2.tail).prepend(erasure(cl1.head));
        }
        return intersect(cl1.tail, cl2.tail);
    }
914582
function(or1, or2) {
			var c = or2.values[0],
				d = or2.values[1];

			var intersection1 = set.intersection(or1, c);
			var intersection2 = set.intersection(or1, d);

			if (!isOr(intersection1) || !isOr(intersection2)) {
				return set.union(intersection1, intersection2);
			}
			intersection1 = set.union(or2, or1.values[0]);
			intersection2 = set.union(or2, or1.values[1]);

			if (!isOr(intersection1) || !isOr(intersection2)) {
				return set.union(intersection1, intersection2);
			} else {
				return new is.Or([or1, or2]);
			}
		}