How to iterate through Java List? 4 way to iterate through loop

CrunchifyIterateThroughList Java - Crunchify Tutorial

How to iterate through Java List? This tutorial demonstrates the use of ArrayList, Iterator and a List.

There are 4 ways you can iterate through List.

  1. For Loop
  2. Advanced For Loop
  3. Iterator
  4. While Loop

Here is a sample Java Example.

Output:

Have anything to add to this article? Please chime in and join the conversion.
Tweet about this on TwitterShare on FacebookShare on Google+Pin on PinterestShare on TumblrBuffer this page

Enjoyed this post?

Be sure to subscribe to the Crunchify newsletter and get regular updates about awesome posts just like this one and more! Join more than 8000 subscribers!

  • Gerralt

    Hello a.shah,

    I recently found your site but I wish I found it when I was in the very early stage of learning Java… This site is great! Very nicely done and I’ll recommend this to anyone who wants to learn Java!

    Gerralt

    • http://crunchify.com/ a.shah

      Thanks for stopping by and sharing your thoughts :)

  • http://www.javaexperience.com/ Sandeep

    Nice tutorial. The 4 ways you have shown are really excellent.
    Do let me know your views on my blog post on various topics related to Iterators

    • http://crunchify.com/ a.shah

      Thanks Sandeep for your share…

  • Ricky Thomas

    Awesome Tutorial Crunchify. Found this site recently and I must say very nice work. Keep going.

    • http://crunchify.com/ a.shah

      Awesome.. Thanks Ricky for your comment..