sorted method

List<T> sorted()

Returns an unmodifiable list of sorted values.

Example

import 'package:calc/calc.dart';

void main() {
  final iterable = <int>{3, 1, 2, 4, 5};
  final x = iterable.sorted().fractionalRange(0.0, 0.3).mean();
  print('Mean of the lowest 30 percent: $x');
}

Implementation

List<T> sorted() {
  final sorted = toList(growable: false);
  sorted.sort();
  return List<T>.unmodifiable(sorted);
}