Class Repeated<T>

  • Type Parameters:
    T - Element type
    All Implemented Interfaces:
    Iterator<T>

    public final class Repeated<T>
    extends Object
    implements Iterator<T>
    Repeat an element.

    If you need to repeat endlessly, use Endless.

    Since:
    0.4
    • Constructor Detail

      • Repeated

        public Repeated​(int max,
                        T element)
        Ctor.
        Parameters:
        max - How many times to repeat
        element - Element to repeat
      • Repeated

        public Repeated​(int max,
                        Scalar<? extends T> scalar)
        Ctor.
        Parameters:
        max - How many times to repeat
        scalar - Scalar to repeat
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface Iterator<T>
      • next

        public T next()
        Specified by:
        next in interface Iterator<T>