try
{
LOCK.readLock().lock();
- return new RangeElementsIterator(start, end,
+ return new RangeElementsIterator(
new VisibleContigsIterator(start, end + 1, hiddenColumns));
} finally
{
private int[] nextRange = null;
- RangeElementsIterator(int from, int to, Iterator<int[]> it)
+ RangeElementsIterator(Iterator<int[]> it)
{
- last = to;
- current = from;
- next = from;
rangeIterator = it;
if (rangeIterator.hasNext())
{
nextRange = rangeIterator.next();
+ next = nextRange[0];
+ last = nextRange[1];
}
- checkNextRange();
}
@Override
public boolean hasNext()
{
- return next <= last;
+ return rangeIterator.hasNext() || next <= last;
}
@Override
public Integer next()
{
- if (next > last)
+ if (!hasNext())
{
throw new NoSuchElementException();
}
*/
private void checkNextRange()
{
- if (nextRange != null && next >= nextRange[0])
+ if (nextRange != null && next > nextRange[1])
{
- next = nextRange[1] + 1;
if (rangeIterator.hasNext())
{
nextRange = rangeIterator.next();
+ next = nextRange[0];
+ last = nextRange[1];
}
else
{