Package jmri.util

Class NamedBeanPreferNumericComparator<B extends NamedBean>

java.lang.Object
jmri.util.NamedBeanComparator<B>
jmri.util.NamedBeanPreferNumericComparator<B>
Type Parameters:
B - the type of NamedBean to compare
All Implemented Interfaces:
Comparator<B>

public class NamedBeanPreferNumericComparator<B extends NamedBean>
extends NamedBeanComparator<B>
Compare two NamedBeans using the PreferNumericComparator against NamedBean.getSystemName() for each NamedBean.

If the requirement is that Comparator.compare(Object, Object) return 0 for two numerically identical NamedBean System Names (i.e. IT42 == IT0042), use NamedBeanComparator, but if the requirement is that System Names should be numerically ordered, but that non-identical representations of numbers should be different, (i.e. IT42 != IT0042, but order should be IT3, IT4, IT5, IT42, IT0042, IT50), use this Comparator.