question: public static < T > boolean containsDuplicates ( List < T > list , Comparator < T > comparator ) { Collections . sort ( list , comparator ) ; T previous = null ; for ( T entry : list ) { if ( previous != null && previous . equals ( entry ) ) { return true ; } previous = entry ; } return false ; }
target:  Checks whether the given list contains duplicates. List entries are compared using the given comparator.