Class AVLTree.TreeNodeIterator

  • All Implemented Interfaces:
    java.util.Iterator<AVLTree.TreeNode<T>>
    Enclosing class:
    AVLTree<T>

    private class AVLTree.TreeNodeIterator
    extends java.lang.Object
    implements java.util.Iterator<AVLTree.TreeNode<T>>
    Iterator over the tree nodes. The nodes are returned according to the in order tree traversal.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int expectedModCount
      Number of modifications of the tree at the time this iterator is created.
      private AVLTree.TreeNode<T> nextNode
      A node that is returned next or null if all nodes are traversed
    • Constructor Summary

      Constructors 
      Constructor Description
      TreeNodeIterator()
      Constructs a new TreeNodeIterator
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void checkForComodification()
      Checks if the tree has been modified during the iteration process
      boolean hasNext()
      AVLTree.TreeNode<T> next()
      • Methods inherited from class java.lang.Object

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

        forEachRemaining, remove
    • Field Detail

      • nextNode

        private AVLTree.TreeNode<T> nextNode
        A node that is returned next or null if all nodes are traversed
      • expectedModCount

        private final int expectedModCount
        Number of modifications of the tree at the time this iterator is created.
    • Constructor Detail

      • TreeNodeIterator

        public TreeNodeIterator()
        Constructs a new TreeNodeIterator
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<AVLTree.TreeNode<T>>
      • checkForComodification

        private void checkForComodification()
        Checks if the tree has been modified during the iteration process