Package jmri.util

Class PreferNumericComparator

All Implemented Interfaces:

public class PreferNumericComparator
extends AlphanumComparator
Perform an comparison using AlphanumComparator, followed up with a standard String comparison if, String) returns 0.

If the requirement is that, Object) return 0 for two numerically identical Strings (i.e. 42 == 0042), use AlphanumComparator, but if the requirement is that Strings should be numerically ordered, but that non-identical representations should be different, (i.e. 42 != 0042, but order should be 3, 4, 5, 42, 0042, 50), use this Comparator, since the standard String comparator will not order numbers correctly.