Class BooleanIterator

  • All Implemented Interfaces:
    BoundedIterator<java.lang.Boolean>, Iterator<java.lang.Boolean>

    public final class BooleanIterator
    extends java.lang.Object
    implements BoundedIterator<java.lang.Boolean>
    BooleanIterator implements an iterator of boolean values {false, true}.
    • Constructor Summary

      Constructors 
      Constructor Description
      BooleanIterator()
      Constructs a boolean iterator with the initial value equal to false.
      BooleanIterator​(boolean initialValue)
      Constructs a boolean iterator with the given initial value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      BooleanIterator clone()
      Creates a copy of the iterator.
      boolean hasValue()
      Checks if the iterator is not exhausted (a value is available).
      void init()
      Initializes the iterator.
      void next()
      Makes an iteration.
      void setValue​(boolean value)
      Sets the current value of the iterator.
      int size()
      Returns the size of the collection of the iterated items.
      void stop()
      Stops the iterator.
      java.lang.Boolean value()
      Returns the current value of the iterator.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BooleanIterator

        public BooleanIterator​(boolean initialValue)
        Constructs a boolean iterator with the given initial value.
        Parameters:
        initialValue - the initial value.
      • BooleanIterator

        public BooleanIterator()
        Constructs a boolean iterator with the initial value equal to false.
    • Method Detail

      • setValue

        public void setValue​(boolean value)
        Sets the current value of the iterator.
        Parameters:
        value - the value to be set.
      • init

        public void init()
        Description copied from interface: Iterator
        Initializes the iterator.
        Specified by:
        init in interface Iterator<java.lang.Boolean>
      • hasValue

        public boolean hasValue()
        Description copied from interface: Iterator
        Checks if the iterator is not exhausted (a value is available).
        Specified by:
        hasValue in interface Iterator<java.lang.Boolean>
        Returns:
        true if the iterator is not exhausted; false otherwise.
      • value

        public java.lang.Boolean value()
        Description copied from interface: Iterator
        Returns the current value of the iterator.
        Specified by:
        value in interface Iterator<java.lang.Boolean>
        Returns:
        the current value of the iterator.
      • next

        public void next()
        Description copied from interface: Iterator
        Makes an iteration.
        Specified by:
        next in interface Iterator<java.lang.Boolean>
      • stop

        public void stop()
        Description copied from interface: Iterator
        Stops the iterator.
        Specified by:
        stop in interface Iterator<java.lang.Boolean>
      • size

        public int size()
        Description copied from interface: BoundedIterator
        Returns the size of the collection of the iterated items.
        Specified by:
        size in interface BoundedIterator<java.lang.Boolean>
        Returns:
        the number of items being iterated.
      • clone

        public BooleanIterator clone()
        Description copied from interface: Iterator
        Creates a copy of the iterator.
        Specified by:
        clone in interface Iterator<java.lang.Boolean>
        Overrides:
        clone in class java.lang.Object
        Returns:
        A copy of the iterator.