-
Notifications
You must be signed in to change notification settings - Fork 116
Open
Description
Hi Varun
Thanks alot for sharing such clean and easy to understand solution,
Can you please explain what this sorting comparator class will be doing.
what purpose does it solve I hope i am not asking too much but if you could give line by line comment to the comparator class code that will be great.
I am refering to the below code.
class sort implements Comparator<ArrayList> {
@Override
public int compare(ArrayList<Integer> o1, ArrayList<Integer> o2) {
int c = o1.get(0).compareTo(o2.get(0));
if (c == 0) {
c = o1.get(1).compareTo(o2.get(1));
}
if (c == 0) {
c = o1.get(2).compareTo(o2.get(2));
}
if (c == 0) {
c = o1.get(3).compareTo(o2.get(3));
}
return c;
}
}
Metadata
Metadata
Assignees
Labels
No labels