Scenario Suppose we want to show a list of registered users of the application in a tabular format on a jsp. The list of users is created on the server and is bound to an attribute (in request, session or application scope) if you are using servlet or bound to an attribute in ModelAndView if you are using Spring controller as below.Read More →

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 →