Java:在 for 循环 init 中初始化多个变量?
我想要两个不同类型的循环变量。有没有办法做到这一点?
@Override
public T get(int index) throws IndexOutOfBoundsException {
    // syntax error on first 'int'
    for (Node<T> current = first, int currentIndex; current != null; 
            current = current.next, currentIndex++) {
        if (currentIndex == index) {
            return current.datum;
        }
    }
    throw new IndexOutOfBoundsException();
}
 
					 
				 
				    		 
				    		 
				    		