Home » Java ListIterator next() Method with Examples

Java ListIterator next() Method with Examples

by Online Tutorials Library

Java ListIterator next() Method

The next() method of ListIterator interface is used to return the next element in the given list. This method is used to iterate through the list.

Syntax

Parameters

NA

Specified by:

next in interface Iterator<E>

Return

The above method is used to return the next element in the list.

Throws:

NoSuchElementException– If there are no elements left in the iteration.

Example 1

Test it Now

Output:

The list is given as:   1.1  2.2  3.3  

Example 2

Test it Now

Output:

The list is given as:   a  b  c  

Example 3

Test it Now

Output:

The list is given as:   Programming  Language  

You may also like