Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero is not sorted properly #14

Open
krasa opened this issue Nov 25, 2022 · 0 comments
Open

Zero is not sorted properly #14

krasa opened this issue Nov 25, 2022 · 0 comments

Comments

@krasa
Copy link

krasa commented Nov 25, 2022

It should not skip the zero if there is no other digit.

Unsorted: [9, 0, 1, a[9], a[0], a[00], a[1]]
Sorted: [0, 1, 9, a[1], a[9], a[0], a[00]]
Should be: [0, 1, 9, a[0], a[00], a[1], a[9]]
static void bug() {
	List<String> unSorted = Arrays.asList(
			"9",
			"0",
			"1",
			"a[9]",
			"a[0]",
			"a[00]",
			"a[1]"
	);

	System.out.println("Unsorted: " + unSorted);

	unSorted.sort(new NaturalOrderComparator());

	System.out.println("Sorted: " + unSorted);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant