ch.epfl.labos.iu.orm.LazyIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api Show documentation
Show all versions of api Show documentation
Jinq public API for extending Java 8 streams with database functionality
/**
*
*/
package ch.epfl.labos.iu.orm;
import java.util.Iterator;
public class LazyIterator implements Iterator
{
public LazySet parent;
LazyIterator(LazySet parent)
{
this.parent = parent;
}
Iterator realIterator = null;
public boolean hasNext()
{
if (realIterator == null)
{
parent.realize();
realIterator = parent.data.iterator();
}
return realIterator.hasNext();
}
public T next()
{
if (realIterator == null)
{
parent.realize();
realIterator = parent.data.iterator();
}
return realIterator.next();
}
public void remove()
{
if (realIterator == null)
{
parent.realize();
realIterator = parent.data.iterator();
}
realIterator.remove();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy