Skip to content

Zero is not sorted properly #14

Description

@krasa

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);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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