@ Override public Iterator < E > iterator ( ) { return new Iterator < E > ( ) { int iteratorIndex ; int iteratorBufferIndex ; int iteratorOffset ; @ Override public boolean hasNext ( ) { return iteratorIndex < size ; } @ Override public E next ( ) { if ( iteratorIndex >= size ) { throw new NoSuchElementException ( ) ; } E [ ] buf = buffers [ iteratorBufferIndex ] ; E result = buf [ iteratorOffset ] ; // increment iteratorIndex ++ ; iteratorOffset ++ ; if ( iteratorOffset >= buf . length ) { iteratorOffset = 0 ; iteratorBufferIndex ++ ; } return result ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } ; }
Returns an iterator over buffer elements .