Class CharIterators.AbstractIndexBasedListIterator

  • All Implemented Interfaces:
    BidirectionalIterator<java.lang.Character>, CharBidirectionalIterator, CharIterator, CharListIterator, ObjectBidirectionalIterator<java.lang.Character>, ObjectIterator<java.lang.Character>, java.util.Iterator<java.lang.Character>, java.util.ListIterator<java.lang.Character>, java.util.PrimitiveIterator<java.lang.Character,​CharConsumer>
    Enclosing class:
    CharIterators

    public abstract static class CharIterators.AbstractIndexBasedListIterator
    extends CharIterators.AbstractIndexBasedIterator
    implements CharListIterator
    A skeletal implementation for a list-iterator backed by an index-based data store. High performance concrete implementations (like the main ListIterator of ArrayList) generally should avoid using this and just implement the interface directly, but should be decent for less performance critical implementations.

    This class is only appropriate for sequences that are at most Integer.MAX_VALUE long. If your backing data store can be bigger then this, consider the equivalently named class in the type specific BigListSpliterators class.

    As the abstract methods in this class are used in inner loops, it is generally a good idea to override the class as final as to encourage the JVM to inline them (or alternatively, override the abstract methods as final).

    • Method Detail

      • hasPrevious

        public boolean hasPrevious()
        Description copied from interface: BidirectionalIterator
        Returns whether there is a previous element.
        Specified by:
        hasPrevious in interface BidirectionalIterator<java.lang.Character>
        Specified by:
        hasPrevious in interface java.util.ListIterator<java.lang.Character>
        Returns:
        whether there is a previous element.
        See Also:
        ListIterator.hasPrevious()
      • nextIndex

        public int nextIndex()
        Specified by:
        nextIndex in interface java.util.ListIterator<java.lang.Character>
      • previousIndex

        public int previousIndex()
        Specified by:
        previousIndex in interface java.util.ListIterator<java.lang.Character>
      • add

        public void add​(char k)
        Description copied from interface: CharListIterator
        Inserts the specified element into the list (optional operation).

        This default implementation just throws an UnsupportedOperationException.

        Specified by:
        add in interface CharListIterator
        Parameters:
        k - the element to insert.
        See Also:
        ListIterator.add(Object)
      • set

        public void set​(char k)
        Description copied from interface: CharListIterator
        Replaces the last element returned by CharListIterator.next() or CharListIterator.previous() with the specified element (optional operation).
        Specified by:
        set in interface CharListIterator
        Parameters:
        k - the element used to replace the last element returned.

        This default implementation just throws an UnsupportedOperationException.

        See Also:
        ListIterator.set(Object)