Hello!

This is a gentle reminder.

The proposed comparator implementation would be particularly useful when one will need to compare version strings. Some popular file managers also use similar comparing algorithm, as the results often look more natural to the human eyes (e.g. File Explorer on Windows, Files on Ubuntu).

Now, as Java 10 is been worked on, to sort the list of Java names correctly, this kind of comparator is needed:

Look: a list { ... "Java 8", "Java 9", "Java 10" } definitely looks nicer than { "Java 1", "Java 10", "Java 2", ... } :-)

Would you please help review the proposal?

With kind regards,
Ivan


On 7/19/17 1:41 AM, Ivan Gerasimov wrote:
Hello!

It is a proposal to provide a String comparator, which will pay attention to the numbers embedded into the strings (should they present).

This proposal was initially discussed back in 2014 and seemed to bring some interest from the community: http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-December/030343.html

In the latest webrev two methods are added to the public API:
j.u.Comparator.comparingNumerically() and
j.u.Comparator.comparingNumericallyLeadingZerosAhead().

The regression test is extended to exercise this new comparator.

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8134512
WEBREV: http://cr.openjdk.java.net/~igerasim/8134512/01/webrev/

Comments, suggestions are very welcome!


--
With kind regards,
Ivan Gerasimov

Reply via email to