Class NodeComparator

  • All Implemented Interfaces:
    java.util.Comparator

    public class NodeComparator
    extends java.lang.Object
    implements java.util.Comparator
    Comparator for nodes. It returns all Branch nodes first, followed by all Leaf nodes. Within each group, items are ordered alphabetically.
    Since:
    25 Feb 2005
    Author:
    Mark Taylor (Starlink)
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeComparator()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.lang.Object o1, java.lang.Object o2)  
      java.text.Collator getCollator()
      Returns the collator used to perform alphabetic ordering.
      static NodeComparator getInstance()
      Returns an instance of this class.
      • 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
    • Constructor Detail

      • NodeComparator

        public NodeComparator()
    • Method Detail

      • getInstance

        public static NodeComparator getInstance()
        Returns an instance of this class.
      • getCollator

        public java.text.Collator getCollator()
        Returns the collator used to perform alphabetic ordering. May be overridden to modify behaviour.
        Returns:
        collator
      • compare

        public int compare​(java.lang.Object o1,
                           java.lang.Object o2)
        Specified by:
        compare in interface java.util.Comparator