Class TShortIterator



  • public class TShortIterator
    extends Object
    Iterator for short collections.
    • Field Summary

      Fields

      Modifier and Type Field and Description
      protected int _expectedSize
      the number of elements this iterator believes are in the data structure it accesses.
      protected int _index
      the index used for iteration.
    • Constructor Summary

      Constructors

      Constructor and Description
      TShortIterator(TShortHash hash)
      Creates a TShortIterator for the elements in the specified collection.
    • Method Summary

      Modifier and Type Method and Description
      boolean hasNext()
      Returns true if the iterator can be advanced past its current location.
      protected void moveToNextIndex()
      Sets the internal index so that the `next' object can be returned.
      short next()
      Advances the iterator to the next element in the underlying collection and returns it.
      protected int nextIndex()
      Returns the index of the next value in the data structure or a negative value if the iterator is exhausted.
      void remove()
      Removes the last entry returned by the iterator.
    • Field Detail

      • _expectedSize

        protected int _expectedSize
        the number of elements this iterator believes are in the data structure it accesses.
      • _index

        protected int _index
        the index used for iteration.
    • Constructor Detail

      • TShortIterator

        public TShortIterator(TShortHash hash)
        Creates a TShortIterator for the elements in the specified collection.
    • Method Detail

      • next

        public short next()
        Advances the iterator to the next element in the underlying collection and returns it.
        Returns:
        the next short in the collection
        Throws:
        NoSuchElementException - if the iterator is already exhausted
      • nextIndex

        protected final int nextIndex()
        Returns the index of the next value in the data structure or a negative value if the iterator is exhausted.
        Returns:
        an int value
        Throws:
        ConcurrentModificationException - if the underlying collection's size has been modified since the iterator was created.
      • hasNext

        public boolean hasNext()
        Returns true if the iterator can be advanced past its current location.
        Returns:
        a boolean value
      • remove

        public void remove()
        Removes the last entry returned by the iterator. Invoking this method more than once for a single entry will leave the underlying data structure in a confused state.
      • moveToNextIndex

        protected final void moveToNextIndex()
        Sets the internal index so that the `next' object can be returned.