• Post Reply Bookmark Topic Watch Topic
  • New Topic

New for loop format help required  RSS feed

 
venkatesh gonibeedu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to replace this function to
final List<String> items = res.getIteamInQueue(a.SYSTEM, rc.ddp.toString()).getList("cIds", String.class));
            for (int i = 0; i < items.size(); i++) {
}

How to replace with new format of for loop

for (List<String> l : items)
{
}

As am getting an error on changing to this new type of for loop




 
Paweł Baczyński
Bartender
Posts: 2061
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Read this tutorial and everything will be clear.

By the way, the enhanced for loop was introduced in Java 5, not Java 8.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!