Package jmri.util

Class NamedBeanPreferNumericComparator<B extends NamedBean>

  • Type Parameters:
    B - the type of NamedBean to compare
    All Implemented Interfaces:
    java.util.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.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(B n1, B n2)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong