equals method

bool equals(
  1. Iterable y, [
  2. bool compareOrder = true
])

Implementation

bool equals(Iterable<dynamic> y, [bool compareOrder = true]) {
  if (length != y.length) {
    return false;
  }
  final List<dynamic> x = toList();
  final List<dynamic> yList = y.toList();
  if (compareOrder) {
    for (int i = 0; i < length; i++) {
      if (x[i] != yList[i]) {
        return false;
      }
    }
    return true;
  }
  for (int i = 0; i < length; i++) {
    for (int j = 0; j < yList.length; j++) {
      if (x[i] == yList[j]) {
        yList.removeAt(j);
        break;
      }
    }
  }
  if (yList.isEmpty) {
    return true;
  }
  return false;
}