Comparator typedef

int Comparator(T a, T b)

The signature of a generic comparison function.

A comparison function represents an ordering on a type of objects. A total ordering on a type means that for two values, either they are equal or one is greater than the other (and the latter must then be smaller than the former).

A Comparator function represents such a total ordering by returning

  • a negative integer if a is smaller than b,
  • zero if a is equal to b, and
  • a positive integer if a is greater than b.

Source

typedef int Comparator<T>(T a, T b);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-core/Comparator.html