Skip to content

I have query in Hashing/Equal.java #1

@chaudharisuresh997

Description

@chaudharisuresh997

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions