Class CachingIterator<T>

java.lang.Object
org.aksw.commons.collections.cache.CachingIterator<T>
Type Parameters:
T -
C -
All Implemented Interfaces:
Iterator<T>

public class CachingIterator<T> extends Object implements Iterator<T>
In iterator that adds items to a cache as it proceeds. It is valid for other iterators with the same delegate and cache to exist. However, no iterator must be positioned beyond the cache.data's size.
Author:
raven
  • Field Details

    • cache

      protected Cache<T> cache
    • delegate

      protected Iterator<T> delegate
    • offset

      protected int offset
  • Constructor Details

    • CachingIterator

      public CachingIterator(Cache<T> cache, Iterator<T> delegate)
    • CachingIterator

      public CachingIterator(Cache<T> cache, Iterator<T> delegate, int offset)
  • Method Details

    • hasNext

      public boolean hasNext()
      The cache's isComplete flag is only set if a call to hasNext returns false.
      Specified by:
      hasNext in interface Iterator<T>
    • next

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