compareByFieldNatural<T, F> function

Comparator<T> compareByFieldNatural<T, F>(
  1. F fieldValue(
    1. T t
    ), {
  2. Comparator<F> comparator = compareNaturalOrder,
})

Implementation

Comparator<T> compareByFieldNatural<T, F>(
  F Function(T t) fieldValue, {
  Comparator<F> comparator = compareNaturalOrder,
}) {
  return (a, b) {
    return comparator(
      fieldValue(a),
      fieldValue(b),
    );
  };
}