merge<T> function
Implementation
List<T> merge<T>(List<T> list1, List<T> list2) {
List<T> output = [];
var minLength = min(list1.length, list2.length);
var maxLength = max(list1.length, list2.length);
for (var i = 0; i < minLength; i++) {
output.add(list1[i]);
output.add(list2[i]);
}
List<T> longer = list1.length > list2.length ? list1 : list2;
for (var i = minLength; i < maxLength; i++) {
output.add(longer[i]);
}
return output;
}