Link Details

Link 138993 thumbnail
User 111696 avatar

By bloid
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
  • 3419
  • 1


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)

Apache Hadoop
Written by: Piotr Krewski
Featured Refcardz: Top Refcardz:
  1. Play
  2. Akka
  3. Design Patterns
  4. OO JS
  5. Cont. Delivery
  1. Play
  2. Java Performance
  3. Akka
  4. REST
  5. Java