sortedBy<K extends Comparable> method

Bloom<List<E>> sortedBy<K extends Comparable>(
  1. K keyOf(
    1. E element
    ), [
  2. int start = 0,
  3. int? end
])

Returns a new unmodifiable list containing elements sorted by key extracted via keyOf.

  • keyOf: Function extracting the comparable key from each element.
  • start: Optional inclusive start index. Defaults to 0.
  • end: Optional exclusive end index.

Implementation

Bloom<List<E>> sortedBy<K extends Comparable<dynamic>>(
        K Function(E element) keyOf,
        [int start = 0,
        int? end]) =>
    computed((via) {
      final copy = via(_listBloom).toList();
      col.ListExtensions(copy)
          .sortByCompare<K>(keyOf, (a, b) => a.compareTo(b), start, end);
      return List<E>.unmodifiable(copy);
    });