public static <T, U> Comparator<T> comparing (Function<? super T, ? extends U> keyExtractor, Comparator<? super U> keyComparator)

Accepts a function that extracts a sort key from a type T, and returns a Comparator<T> that compares by that sort key using the specified Comparator.

The returned comparator is serializable if the specified function and comparator are both serializable.

Parameters:
<T>    the type of element to be compared
<U>    the type of the sort key
keyExtractor    the function used to extract the sort key
keyComparator    the Comparator used to compare the sort key

Returns:  a comparator that compares by an extracted key using the specified Comparator

Exceptions:
NullPointerException    if either argument is null

Since:  1.8

@apiNote For example, to obtain a Comparator that compares Person objects by their last name ignoring case differences,


     Comparator<Person> cmp = Comparator.comparing(
             Person::getLastName,
             String.CASE_INSENSITIVE_ORDER);