intersectsIterableDeep function

bool intersectsIterableDeep(
  1. Iterable? it1,
  2. Iterable? it2, {
  3. ValueEquality? valueEquality,
})

Implementation

bool intersectsIterableDeep(Iterable? it1, Iterable? it2,
    {ValueEquality? valueEquality}) {
  if (identical(it1, it2)) return true;

  if (it1 == null || it2 == null) return false;
  if (it1.isEmpty || it2.isEmpty) return false;

  var length1 = it1.length;
  var length2 = it2.length;

  for (var i = 0; i < length1; i++) {
    var v1 = it1.elementAt(i);

    for (var j = 0; j < length2; ++j) {
      var v2 = it2.elementAt(j);
      if (isEqualsDeep(v1, v2, valueEquality: valueEquality)) return true;
    }
  }

  return false;
}