sorted method
Returns a sorted copy of the provided iterable
.
If stable
is set to true
, a stable merge-sort implementation is used
instead of the standard quick-sort. This means that elements that compare
equal stay in the order of the input.
If start
(inclusive) and end
(exclusive) are provided the sorting
only happens within the specified range.
Implementation
List<T> sorted(Iterable<T> iterable,
{int? start, int? end, bool stable = false}) {
final list = List.of(iterable, growable: false);
sort(list, start: start, end: end, stable: stable);
return list;
}