Class SmallSortedMap.EntryIterator

  • All Implemented Interfaces:
    java.util.Iterator<java.util.Map.Entry<K,​V>>
    Enclosing class:
    SmallSortedMap<K extends java.lang.Comparable<K>,​V>

    private class SmallSortedMap.EntryIterator
    extends java.lang.Object
    implements java.util.Iterator<java.util.Map.Entry<K,​V>>
    Iterator implementation that switches from the entry array to the overflow entries appropriately.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private EntryIterator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.util.Iterator<java.util.Map.Entry<K,​V>> getOverflowIterator()
      It is important to create the overflow iterator only after the array entries have been iterated over because the overflow entry set changes when the client calls remove() on the array entries, which invalidates any existing iterators.
      boolean hasNext()  
      java.util.Map.Entry<K,​V> next()  
      void remove()  
      • 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
    • Field Detail

      • pos

        private int pos
      • nextCalledBeforeRemove

        private boolean nextCalledBeforeRemove
      • lazyOverflowIterator

        private java.util.Iterator<java.util.Map.Entry<K extends java.lang.Comparable<K>,​V>> lazyOverflowIterator
    • Constructor Detail

      • EntryIterator

        private EntryIterator()
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<java.util.Map.Entry<K extends java.lang.Comparable<K>,​V>>
      • next

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

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<java.util.Map.Entry<K extends java.lang.Comparable<K>,​V>>
      • getOverflowIterator

        private java.util.Iterator<java.util.Map.Entry<K,​V>> getOverflowIterator()
        It is important to create the overflow iterator only after the array entries have been iterated over because the overflow entry set changes when the client calls remove() on the array entries, which invalidates any existing iterators.