how to interate through List in java code example
Example 1: java loop through list
for (E element : list) {
. . .
}
Example 2: iterate list in java
Iterator itr=list.iterator();
while(itr.hasNext)
{
system.out.println(itr.next);
}
for (E element : list) {
. . .
}
Iterator itr=list.iterator();
while(itr.hasNext)
{
system.out.println(itr.next);
}