Class NodeComparator

  • All Implemented Interfaces:
    Comparator<Node>

    public class NodeComparator
    extends Object
    implements Comparator<Node>
    A node comparison function, which involves comparing the title of the nodes.

    Clients may subclass this class.

    See Also:
    Node.getTitle()
    • Constructor Detail

      • NodeComparator

        public NodeComparator()
        Instantiates a new node comparator.
    • Method Detail

      • compare

        public int compare​(Node o1,
                           Node o2)
        Compares the two nodes. Returns a negative integer, zero, or a positive integer as the first node title is less than, equal to, or greater than the second.
        Specified by:
        compare in interface Comparator<Node>
        Parameters:
        o1 - the first node to be compared.
        o2 - the second node to be compared.
        Returns:
        a negative integer, zero, or a positive integer as the first node title is less than, equal to, or greater than the second.