Multiple Choice
Which of the following statements correctly provides a comparator function using lambda expressions to sort an array of countries by population, assuming the existence of a getPopulation method?
A) Arrays.sort(countries, comparator(c -> c.getPopulation() ) ) ;
B) Arrays.sort(countries, compare(c1 -> c1.getPopulation() , c2 -> c2.getPopulation() ) ;
C) Arrays.sort(countries, (c1, c2) -> c1.getPopulation() - c2.getPopulation() ) ;
D) Arrays.sort(countries, c -> c.getPopulation() ) ;
Correct Answer:

Verified
Correct Answer:
Verified
Q50: Assume we are using quicksort to sort
Q51: Merge sort is a(n) _ algorithm.<br>A)O(log n)<br>B)O(n
Q52: Suppose an array has n elements.We visit
Q53: A search technique where, in each step,
Q54: Suppose the call obj1.compareTo(obj2) returns 0.What can
Q56: The method findLargest examines the elements of
Q57: Consider the sort method shown below for
Q58: In big-Oh notation, when we consider the
Q59: The merge sort algorithm presented in section
Q60: A version of which sort algorithm is