@ SuppressWarnings ( "NullableProblems" ) @ Override public Iterator < T > iterator ( ) { return new Iterator < T > ( ) { private int index = 0 ; @ Override public boolean hasNext ( ) { return this . index < size ( ) ; } @ Override public T next ( ) { if ( this . index >= size ( ) ) { throw new NoSuchElementException ( this . index + ">=" + size ( ) ) ; } return getElementAt ( this . index ++ ) ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( "Removing is unsupported here" ) ; } } ; }
Generates an iterator to allow the array processing in loops .