Class SequencedHashMap.OrderedIterator

    • Field Detail

      • returnType

        private int returnType
        Holds the type that should be returned from the iterator. The value should be either KEY, VALUE, or ENTRY. To save a tiny bit of memory, this field is also used as a marker for when remove has been called on the current object to prevent a second remove on the same element. Essentially, if this value is negative (i.e. the bit specified by REMOVED_MASK is set), the current position has been removed. If positive, remove can still be called.
      • pos

        private SequencedHashMap.MapEntry pos
        Holds the "current" position in the iterator. When pos.next is the sentinel, we've reached the end of the list.
      • expectedModCount

        private long expectedModCount
        Holds the expected modification count. If the actual modification count of the map differs from this value, then a concurrent modification has occurred.
    • Constructor Detail

      • OrderedIterator

        OrderedIterator​(int returnType)
        Construct an iterator over the sequenced elements in the order in which they were added. The next() method returns the type specified by returnType which must be either KEY, VALUE, or ENTRY.
        Parameters:
        returnType - The type (KEY,VALUE, ENTRY)
    • Method Detail

      • hasNext

        public boolean hasNext()
        Returns whether there is any additional elements in the iterator to be returned.
        Specified by:
        hasNext in interface Iterator
        Returns:
        true if there are more elements left to be returned from the iterator; false otherwise.