public V next() { switch (state) { case ON_ITEM: if (compareToLast(index = moveOne(forwards)) >= 0) state = END; break; case BEFORE_FIRST: seekTo(index = forwards ? lowerBound : upperBound); state = (byte) (upperBound == lowerBound ? LAST : MIDDLE); case LAST: case MIDDLE: state |= ON_ITEM; break; default: throw new NoSuchElementException(); } return current(); }
public V next() { switch (state) { case ON_ITEM: if (compareToLast(index = moveOne(forwards)) >= 0) state = END; break; case BEFORE_FIRST: seekTo(index = forwards ? lowerBound : upperBound); state = (byte) (upperBound == lowerBound ? LAST : MIDDLE); case LAST: case MIDDLE: state |= ON_ITEM; break; default: throw new NoSuchElementException(); } return current(); }
public V next() { switch (state) { case ON_ITEM: if (compareToLast(index = moveOne(forwards)) >= 0) state = END; break; case BEFORE_FIRST: seekTo(index = forwards ? lowerBound : upperBound); state = (byte) (upperBound == lowerBound ? LAST : MIDDLE); case LAST: case MIDDLE: state |= ON_ITEM; break; default: throw new NoSuchElementException(); } return current(); }
public V next() { switch (state) { case ON_ITEM: if (compareToLast(index = moveOne(forwards)) >= 0) state = END; break; case BEFORE_FIRST: seekTo(index = forwards ? lowerBound : upperBound); state = (byte) (upperBound == lowerBound ? LAST : MIDDLE); case LAST: case MIDDLE: state |= ON_ITEM; break; default: throw new NoSuchElementException(); } return current(); }
public V next(K target) { if (!hasNext()) return null; int state = this.state; boolean found = seekTo(target, forwards, (state & (ON_ITEM | BEFORE_FIRST)) != 0); int index = cur.globalIndex(); V next = null; if (state == BEFORE_FIRST && compareToFirst(index) < 0) return null; int compareToLast = compareToLast(index); if ((compareToLast <= 0)) { state = compareToLast < 0 ? MIDDLE : LAST; if (found) { state |= ON_ITEM; next = (V) currentValue(); } } else state = END; this.state = (byte) state; this.index = index; return next; }
public V next(K target) { if (!hasNext()) return null; int state = this.state; boolean found = seekTo(target, forwards, (state & (ON_ITEM | BEFORE_FIRST)) != 0); int index = cur.globalIndex(); V next = null; if (state == BEFORE_FIRST && compareToFirst(index) < 0) return null; int compareToLast = compareToLast(index); if ((compareToLast <= 0)) { state = compareToLast < 0 ? MIDDLE : LAST; if (found) { state |= ON_ITEM; next = (V) currentValue(); } } else state = END; this.state = (byte) state; this.index = index; return next; }
public V next(K target) { if (!hasNext()) return null; int state = this.state; boolean found = seekTo(target, forwards, (state & (ON_ITEM | BEFORE_FIRST)) != 0); int index = cur.globalIndex(); V next = null; if (state == BEFORE_FIRST && compareToFirst(index) < 0) return null; int compareToLast = compareToLast(index); if ((compareToLast <= 0)) { state = compareToLast < 0 ? MIDDLE : LAST; if (found) { state |= ON_ITEM; next = (V) currentValue(); } } else state = END; this.state = (byte) state; this.index = index; return next; }
public V next(K target) { if (!hasNext()) return null; int state = this.state; boolean found = seekTo(target, forwards, (state & (ON_ITEM | BEFORE_FIRST)) != 0); int index = cur.globalIndex(); V next = null; if (state == BEFORE_FIRST && compareToFirst(index) < 0) return null; int compareToLast = compareToLast(index); if ((compareToLast <= 0)) { state = compareToLast < 0 ? MIDDLE : LAST; if (found) { state |= ON_ITEM; next = (V) currentValue(); } } else state = END; this.state = (byte) state; this.index = index; return next; }