Note that f will be called twice on every comparison, so when sorting an
array of size n f will be called 2n log2 n times.
If you are performing a sort the computation for the key is expensive,
consider using sortOn or sortedOn which will compute all the
keys up front before sorting.
Creates a comparator from a projection.
Note that
fwill be called twice on every comparison, so when sorting an array of size nfwill be called 2n log2 n times.If you are performing a sort the computation for the key is expensive, consider using sortOn or sortedOn which will compute all the keys up front before sorting.