compareSearchResult static method
compares two list of nodes for equality.
Implementation
static bool compareSearchResult(List<Node>? result1, List<Node>? result2) {
if ((result1 == null || result1.isEmpty) &&
(result2 == null || result2.isEmpty)) {
return true;
}
if (result1 == null ||
result2 == null ||
result1.length != result2.length) {
return false;
}
SortedList<Node> sl1 = SortedList((a, b) => a.path.compareTo(b.path));
SortedList<Node> sl2 = SortedList((a, b) => a.path.compareTo(b.path));
sl1.addAll(result1);
sl2.addAll(result2);
for (int i = 0; i < sl1.length; i++) {
if (!sl1[i].equals(sl2[i])) {
return false;
}
}
return true;
}