Check out example codes for "java iterator example". It will help you in understanding the concepts better.

Code Example 1

Iterator iterator = list.iterator(); 
        System.out.println("List elements : "); 
        while (iterator.hasNext()) 
            System.out.print(iterator.next() + " ");

Learn ReactJs, React Native from akashmittal.com