I have the following code
import java.util.*;
public class Sorts {
public static void sort(ArrayList objects, Comparator<Car>) {
Comparator compareThing = new CarNameComparator();
int min;
Car temp;
for(int i = 0; i < objects.size() - 1; i++){
min = i;
for(int j = min+1; j < objects.size(); j++){
if(compareThing.compare(objects.get(i), objects.get(j))> 0){
min = j;
}
}
temp = (Car)objects.get(i);
objects.set(i, objects.get(min));
objects.set(min, temp);
}
}
}
and my IDE highlights the close parenthesis at the end of line 3, saying "expected identifier."
I can't tell what it means. This is a static method so it won't have a type, and it's not referring to the comparator because that has an identifier. What should I do?
public static void sort(ArrayList objects, Comparator<Car> identifier)
You missed the argument name in the function parameters.