Link Details

Link 138993 thumbnail
User 111696 avatar

By bloid
via iam.unibe.ch
Published: Dec 05 2008 / 15:40

Java’s foreach loop is useful but limited. Neither can we access the iterator of a running loop, nor can we write Ruby-style foreach loops, such as
  • 8
  • 3
  • 3374
  • 1

Comments

Add your comment
User 168140 avatar

adiand replied ago:

-1 votes Vote down Vote up Reply

IMHO, a custom constructs further obscurity of code without adding consistent value. Yes it read "elegant" to the author... but most of us get paid to author maintainable code and move on. Staying within the constructs of the standard Java language may not be sexy... but it would surely be more understandable to a developer staring down at this at 2 AM trying to troubleshoot :P

If Ruby, or any other language offers a better syntax... use it, I don't agree making Java into Ruby serves a purpose.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (8)



Voters Against This Link (3)



Debugging JavaScript
Written by: Ashutosh Sharma
Featured Refcardz: Top Refcardz:
  1. Design Patterns
  2. OO JS
  3. Cont. Delivery
  4. Java EE7
  5. HTML5 Mobile
  1. Java EE7
  2. Spring Annotations
  3. Git
  4. Java
  5. REST