question: public static < T > T max ( Collection < ? extends T > collection , Comparator < ? super T > comparator ) { if ( comparator == null ) { @ SuppressWarnings ( "unchecked" ) T result = ( T ) max ( ( Collection < java . lang . Comparable > ) collection ) ; return result ; } Iterator < ? extends T > it = collection . iterator ( ) ; T max = it . next ( ) ; while ( it . hasNext ( ) ) { T next = it . next ( ) ; if ( comparator . compare ( max , next ) < 0 ) { max = next ; } } return max ; }
target:  Searches the specified collection for the maximum element using the specified comparator.