Java Deque iterator() Method

The iterator() method of Java Deque Interface is used to return an iterator for the elements in the deque in a proper sequence. The elements are returned in a order from first(head) to last(tail).

Specified by:

  • iterator in interface Collection<E>
  • iterator in interface Iterable<E>

Syntax:

Parameter:

NA

Return:

The above method returns an iterator for the elements in the given deque in a proper sequence.

Example 1

Test it Now

Output:

The series of month is given as : 
January
February
March
April
May
June
July
August
September
October
November
December

Example 2

Test it Now

Output:

The series of marks is given as : 
34.0
25.0
66.0
39.0
Next TopicJava Deque




Latest Courses