Class SerialMultiDataIterator

java.lang.Object
org.openspaces.persistency.support.SerialMultiDataIterator
All Implemented Interfaces:
DataIterator, Iterator, MultiDataIterator

public class SerialMultiDataIterator extends Object implements MultiDataIterator
A simple implementation wrapping several iterators and exposing them as a single (serial) iterator.

Note, this implementation assumes that hasNext() is called before next() is called. And that next() is called only when hasNext() returns true.

Author:
kimchy
  • Constructor Details

    • SerialMultiDataIterator

      public SerialMultiDataIterator(DataIterator... iterators)
  • Method Details

    • iterators

      public DataIterator[] iterators()
      Description copied from interface: MultiDataIterator
      Returns the underlying iterators. Note, calling this method should only be performed if no iteration has happened.
      Specified by:
      iterators in interface MultiDataIterator
    • hasNext

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

      public Object next()
      Specified by:
      next in interface Iterator
    • close

      public void close()
      Description copied from interface: DataIterator
      Clean up after any resources associated with this iterator The iterator can be closed even if the iterator wasn't iterated over all of its elements.
      Specified by:
      close in interface DataIterator
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator