Class SingleElementInfiniteIterator<T>

java.lang.Object
net.spy.memcached.internal.SingleElementInfiniteIterator<T>
All Implemented Interfaces:
Iterator<T>

public class SingleElementInfiniteIterator<T> extends Object implements Iterator<T>
An iterator that returns a single element for as many elements as are needed from the iterator; in other words, #hasNext() never returns false.
  • Field Details

    • element

      private final T element
  • Constructor Details

    • SingleElementInfiniteIterator

      public SingleElementInfiniteIterator(T element)
      Construct a iterator tat returns the input element an infinite number of times.
      Parameters:
      element - the element that #next() should return
  • Method Details

    • hasNext

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

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

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