sortedByCompare<K> method

Bloom<List<E>> sortedByCompare<K>(
  1. K keyOf(
    1. E element
    ),
  2. int compare(
    1. K a,
    2. K b
    ), [
  3. int start = 0,
  4. int? end,
])

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

  • keyOf: Function extracting the sort key from each element.
  • compare: Comparator comparing extracted keys.
  • start: Optional inclusive start index. Defaults to 0.
  • end: Optional exclusive end index.

Implementation

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