Determines if all values in a1 appear in a2 and that all values in a2 appear in a2.
493027
public static <T> boolean intersectsAll(T[] a1, T[] a2) {
        for (T anA1 : a1) {
            if (!contains(a2, anA1)) {
                return false;
            }
        }

        for (T anA2 : a2) {
            if (!contains(a1, anA2)) {
                return false;
            }
        }

        return true;
    }
546353
function(a, b) {
      var keys = Object.keys(b)
        , i = 0
        , l = keys.length
        , val;

      for (; i < l; i++) {
        val = b[keys[i]];
        if (has(a, val)) return true;
      }

      return false;
    }
10162
def intersect(a, b):
    
    if a[x0] == a[x1] or a[y0] == a[y1]:
        return False
    if b[x0] == b[x1] or b[y0] == b[y1]:
        return False
    return a[x0] <= b[x1] and b[x0] <= a[x1] and a[y0] <= b[y1] and b[y0] <= a[y1]
95568
def check_splits_equals(splits1, splits2):
  """"""
  if set(splits1) ^ set(splits2):  # Name intersection should be null
    return False
  for _, (split1, split2) in utils.zip_dict(splits1, splits2):
    if split1.num_shards != split2.num_shards:
      return False
  return True
464345
protected boolean collectionsEqual(Collection a1, Collection a2) {
		if (a1 != null && a2 != null && a1.size() == a2.size()) {
			// Loop over each element and compare them using our comparator
			Iterator iterA1 = a1.iterator();
			Iterator iterA2 = a2.iterator();
			while (iterA1.hasNext()) {
				if (!equalByComparator(iterA1.next(), iterA2.next())) {
					return false;
				}
			}
		}
		else if (a1 == null && a2 == null) {
			return true;
		}
		return false;
	}
348444
function(a, b)
	{
		if ((a == null && b != null) || (a != null && b == null) ||
			(a != null && b != null && a.length != b.length))
		{
			return false;
		}
		else if (a != null && b != null)
		{
			for (var i = 0; i < a.length; i++)
			{
				if (a[i] == b[i] || (a[i] != null && !a[i].equals(b[i])))
				{
					return false;
				}
			}
		}
		
		return true;
	}
915281
function compareCells(a, b) {
  var n = a.length
    , t = a.length - b.length
    , min = Math.min
  if(t) {
    return t
  }
  switch(n) {
    case 0:
      return 0;
    case 1:
      return a[0] - b[0];
    case 2:
      var d = a[0]+a[1]-b[0]-b[1]
      if(d) {
        return d
      }
      return min(a[0],a[1]) - min(b[0],b[1])
    case 3:
      var l1 = a[0]+a[1]
        , m1 = b[0]+b[1]
      d = l1+a[2] - (m1+b[2])
      if(d) {
        return d
      }
      var l0 = min(a[0], a[1])
        , m0 = min(b[0], b[1])
        , d  = min(l0, a[2]) - min(m0, b[2])
      if(d) {
        return d
      }
      return min(l0+a[2], l1) - min(m0+b[2], m1)
    
    //TODO: Maybe optimize n=4 as well?
    
    default:
      var as = a.slice(0)
      as.sort()
      var bs = b.slice(0)
      bs.sort()
      for(var i=0; i<n; ++i) {
        t = as[i] - bs[i]
        if(t) {
          return t
        }
      }
      return 0
  }
}
19623
public static int checkedMultiply(int a, int b) {
    long result = (long) a * b;
    checkNoOverflow(result == (int) result);
    return (int) result;
  }
1373987
private function valuesAreEqual($a, $b)
    {
        if (is_array($a) && is_array($b)) {
            ksort($a);
            ksort($b);
        }

        return $a === $b;
    }
107728
public static boolean allEquals(final String value, final String... strings) {
        if (strings != null) {
            for (final String s : strings) {
                if (s == null && value != null || s != null && !s.equals(value)) {
                    return false;
                }
            }
        } else {
            return value == null;
        }
        return true;

    }
1011700
def overlaps(self, other):
        """"""
        if self > other:
            smaller, larger = other, self
        else:
            smaller, larger = self, other
        if larger.empty():
            return False
        if smaller._upper_value == larger._lower_value:
            return smaller._upper == smaller.CLOSED and larger._lower == smaller.CLOSED
        return larger._lower_value < smaller._upper_value
371880
def overlap(intv1, intv2):
    """"""
    return max(0, min(intv1[1], intv2[1]) - max(intv1[0], intv2[0]))
362886
private boolean attributeValuesMatch(Set attributes, int runIndex1, int runIndex2) {
        Iterator iterator = attributes.iterator();
        while (iterator.hasNext()) {
            Attribute key = (Attribute) iterator.next();
           if (!valuesMatch(getAttribute(key, runIndex1), getAttribute(key, runIndex2))) {
                return false;
            }
        }
        return true;
    }
128097
def contains(self, other):
        """"""
        return self._start <= other.start and self._end >= other.end
1331344
function ( array1, array2 ) {
		var a = array1.length > array2.length ? array1 : array2,
		    b = ( a === array1 ? array2 : array1 );

		return a.filter( function ( key ) {
			return array.contains( b, key );
		});
	}
935487
function(fs1, fs2) {
        if(!fs2 || (fs2.length > fs1.length)) return false;
        for (var key in fs2) {
            var fact = fs2[key];
            if(!(fact.appearsIn(fs1))) {
                return false;
            }
        }
        return true;
    }
429792
def matches(s, t, i, j, k):
    """"""
    for d in range(k):
        if s[i + d] != t[j + d]:
            return False
    return True