Home » Java ConcurrentLinkedQueue iterator() Method with Examples

Java ConcurrentLinkedQueue iterator() Method with Examples

by Online Tutorials Library

Java ConcurrentLinkedQueue iterator() Method

The iterator() method of ConcurrentLinkedQueue class returns an iterator over the elements in ConcurrentLinkedQueue in proper sequence.

Syntax

Parameter

NA.

Specified By

The iterator() method of ConcurrentLinkedQueue class is specified by:

  1. iterator() method in interface Collection<E>.
  2. iterator () method in interface Iterable<E>.
  3. iterator () method in interface AbstractCollection<E>

Return Value

The iterator() method returns an iterator over the elements in ConcurrentLinkedQueue.

Example 1

Test it Now

Output:

1.Ram  2.Sham  3.Mira  4.Rajesh  

Example 2

Test it Now

Output:

1.1.Roll No. =  15cs1029    College =  MVN University    Name = Reema    2.2.Roll No. =  15cs1010    College =  MVN University    Name = Geetanjali    3.3.Roll No. =  17cs1029    College =  MR University    Name = Vineet    4.4.Roll No. =  15cs1011    College =  MVN University    Name = Himanshu  

Example 3

Test it Now

Output:

71018  8000  1178  1190  Max number = 71018  Min number = 1178  

You may also like