blob: 2200effb583299860987eb2afc88d249eb703c46 [file] [log] [blame]
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
bool equalLists<T>(List<T>? a, List<T>? b) {
if (identical(a, b)) return true;
if (a == null || b == null) return false;
if (a.length != b.length) return false;
for (int i = 0; i < a.length; ++i) {
if (a[i] != b[i]) return false;
}
return true;
}
bool equalSets<K>(Set<K>? a, Set<K>? b) {
if (identical(a, b)) return true;
if (a == null || b == null) return false;
if (a.length != b.length) return false;
for (K entry in a) {
if (!b.contains(entry)) return false;
}
return true;
}
bool equalMaps<K, V>(Map<K, V>? a, Map<K, V>? b) {
if (identical(a, b)) return true;
if (a == null || b == null) return false;
if (a.length != b.length) return false;
for (K key in a.keys) {
if (!b.containsKey(key) || a[key] != b[key]) return false;
}
return true;
}