How to iterate over a list in various ways in java / Different methods of list iteration in java
Iterating over a collection is a task that most developers are required to perform during their development task and most of us keep on using the same way which we have used earlier though there are many ways to do this. In this post I am going to list down all those ways. We all might be familiar with these ways. Still, keep on reading to refresh!!! First let’s initialize a list List list = Arrays.asList(new String[]{ “first”,”second”,”third”,”fourth”, “fifth” }); Now let’s begin iteration: Method 1: Using for loop for (int count = 0; count < list.size(); count++) { System.out.println("Item:: " + list.get(count)); } DetailRead More →