public static <T> Comparator<T> comparingInt (ToIntFunction<? super T> keyExtractor)

Accepts a function that extracts an int sort key from a type T, and returns a Comparator<T> that compares by that sort key.

The returned comparator is serializable if the specified function is also serializable.

Parameters:
<T>    the type of element to be compared
keyExtractor    the function used to extract the integer sort key

Returns:  a comparator that compares by an extracted key

Exceptions:
NullPointerException    if the argument is null

See also:
comparing(Function)

Since:  1.8