Class KVTree.EntryIterator<K,​V>

  • All Implemented Interfaces:
    java.util.Iterator<java.util.Map.Entry<K,​V>>
    Enclosing class:
    KVTree<K,​V>

    private static class KVTree.EntryIterator<K,​V>
    extends java.lang.Object
    implements java.util.Iterator<java.util.Map.Entry<K,​V>>
    An iterator over the mappings of a KVTree.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean isLeftToRight
      whether we're iterating from left to right (vs.
      private KVTree<K,​V> nextSubtree
      node that we need to enter
      private java.util.ArrayList<KVTree<K,​V>> stack
      nodes that we've recursed into, but not yet returned
    • Constructor Summary

      Constructors 
      Constructor Description
      EntryIterator​(KVTree<K,​V> tree, boolean isLeftToRight)  
    • Field Detail

      • isLeftToRight

        private final boolean isLeftToRight
        whether we're iterating from left to right (vs. right to left)
      • nextSubtree

        private KVTree<K,​V> nextSubtree
        node that we need to enter
      • stack

        private final java.util.ArrayList<KVTree<K,​V>> stack
        nodes that we've recursed into, but not yet returned
    • Constructor Detail

      • EntryIterator

        EntryIterator​(KVTree<K,​V> tree,
                      boolean isLeftToRight)
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<K>
      • next

        public java.util.Map.Entry<K,​V> next()
        Specified by:
        next in interface java.util.Iterator<K>