This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

forEach and hasNext()  RSS feed

 
Max Rahder
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I translate this into forEach? The part I can't figure out is the code that omits the delimiter for the last item:

Java version:

This sample prints something like: "Groucho, Harpo, Chico"



JSTL version:

How do I put the "has next" test inside the forEach tag?

This sample prints something like: "Groucho, Harpo, Chico, "
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66199
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the varStatus attribute of the forEach tag.
 
Max Rahder
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works great. Thanks for the tip.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!