Home » Java Collection iterator() Method with Examples

Java Collection iterator() Method with Examples

by Online Tutorials Library

Java Collection iterator() Method

The iterator() method of Java Collection Interface returns an iterator over the elements in this collection.

Syntax

Parameters

NA

Return

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

Example 1

Test it Now

Output:

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

Example 2

Test it Now

Output:

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

Example 3

Test it Now

Output:

Characters : [a ,b ,c ,d ,e ,f ,g ,h ,i ,j ,k ,l ,m ,n ,o ,p ,q ,r ,s ,t ,u ,v ,w ,x ,y ,z ,]  
Next TopicJava Collection

You may also like