execute<E> method
Implementation
@override
ListDiffs<E> execute<E>(ListDiffArguments<E> args) {
final List<E> oldList = args.original;
final List<E> newList = args.replacement;
if (identical(oldList, newList)) return ListDiffs<E>.empty(args);
final oldSize = oldList.length;
final newSize = newList.length;
if (oldList.isEmpty && newList.isEmpty) return ListDiffs.empty(args);
if (oldSize == 0) {
return ListDiffs<E>.ofOperations(
[InsertDiff(args, 0, newSize, newList)], args);
}
if (newSize == 0) {
return ListDiffs<E>.ofOperations([DeleteDiff(args, 0, oldSize)], args);
}
final path = _buildPath(args, identityOnly);
final diffs = _buildPatch(path, args)..sort();
return ListDiffs<E>.ofOperations(
diffs.reversed.toList(growable: false), args);
}