This commit is contained in:
lollipopkit
2023-09-11 23:23:46 +08:00
parent 932a9ef3ff
commit 730a62831b
6 changed files with 47 additions and 18 deletions

View File

@@ -81,4 +81,14 @@ extension OrderX<T> on Order<T> {
addAll(missed);
return surplus;
}
/// Dart uses memory address to compare objects by default.
/// This method compares the values of the objects.
bool equals(Order<T> other) {
if (length != other.length) return false;
for (var i = 0; i < length; i++) {
if (this[i] != other[i]) return false;
}
return true;
}
}