Java ListIterator next() 方法

2025年3月22日 | 阅读1分钟

ListIterator 接口的 next() 方法用于返回列表中下一个元素。该方法用于遍历列表。

语法

参数

不适用

指定者

Iterator<E> 接口中的 next

返回

上述方法用于返回列表中的下一个元素。

抛出

NoSuchElementException - 如果迭代中没有剩余元素。

示例 1

输出

The list is given as: 
1.1
2.2
3.3

示例 2

输出

The list is given as: 
a
b
c

示例 3

输出

The list is given as: 
Programming
Language
下一主题Java ListIterator