Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
invent some syntax
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Roedy Green  
View profile  
 More options Sep 1 2012, 8:16 pm
Newsgroups: comp.lang.java.advocacy
From: Roedy Green <see_webs...@mindprod.com.invalid>
Date: Sat, 01 Sep 2012 17:16:21 -0700
Local: Sat, Sep 1 2012 8:16 pm
Subject: invent some syntax
If Java were to be extended so you could call Iterator.remove inside a
for:each, what sort of syntax might you use?
--
Roedy Green Canadian Mind Products http://mindprod.com
A new scientific truth does not triumph by convincing its opponents and making them see the light,
but rather because its opponents eventually die, and a new generation grows up that is familiar with it.
~ Max Planck 1858-04-23 1947-10-04

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Boudewijn Dijkstra  
View profile  
 More options Sep 11 2012, 3:11 pm
Newsgroups: comp.lang.java.advocacy
From: "Boudewijn Dijkstra" <use...@bdijkstra.tmfweb.nl>
Date: Tue, 11 Sep 2012 21:19:49 +0200
Local: Tues, Sep 11 2012 3:19 pm
Subject: Re: invent some syntax
Op Sun, 02 Sep 2012 02:16:21 +0200 schreef Roedy Green  
<see_webs...@mindprod.com.invalid>:

> If Java were to be extended so you could call Iterator.remove inside a
> for:each, what sort of syntax might you use?

First let's establish that any such new syntax would not apply when  
iterating over an array (cause a compile-time error).

A new keyword "remove" could be introduced:

for (E e : c)
        remove;

In case of nesting, I guess this keyword should be defined as to remove  
the current item from the Iterator belonging to the most deeply nested  
for:each block in the current scope.

for (V v : foo)
        for (K k : v.bar())
                remove; // removes k, not v

Another extended syntax would be needed if you want to be able to  
explicitly select an iterator:

for (V v : foo : Iterator<V> vi)
        for (K k : v.bar())
                if (k.isBaz(v)) {
                        vi.remove();
                        break;
                }

--
Gemaakt met Opera's revolutionaire e-mailprogramma:  
http://www.opera.com/mail/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »