Just move the variable declarations ( Node<T> current , int currentIndex ) outside the loop, and it should work. Something like that
int currentIndex; Node<T> current; for (current = first; current != null; current = current.next, currentIndex++) {
or maybe even
int currentIndex; for (Node<T> current = first; current != null; current = current.next, currentIndex++) {
Nikita Rybak Aug 22 '10 at 18:59 2010-08-22 18:59
source share