We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Ignoring whitespaces does not really produce a nice result:
The A The X The a Theme The x
If anything, it would be better to ignore them only between digits, to be able to sort this:
1 1 000 000 10 10 000 10 000 000 100 100 000 1000
public static void whitespace() { List<String> list = new ArrayList<>(); list.add("The a"); list.add("The x"); list.add("Theme"); list.add("The X"); list.add("The A"); Collections.sort(list, new NaturalOrderComparator()); for (String item : list) { System.out.println(item); } System.out.println("---------"); } public static void whitespaceInNumbers() { List<String> list = new ArrayList<>(); list.add("10 000 000"); list.add("1 000 000"); list.add("100 000"); list.add("10 000"); list.add("1000"); list.add("100"); list.add("10"); list.add("1"); Collections.sort(list, new NaturalOrderComparator()); for (String item : list) { System.out.println(item); } System.out.println("---------"); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Ignoring whitespaces does not really produce a nice result:
If anything, it would be better to ignore them only between digits, to be able to sort this:
The text was updated successfully, but these errors were encountered: