e: "Alan Snyder"
>> À: "Brian Goetz"
>> Cc: "core-libs-dev"
>> Envoyé: Vendredi 21 Décembre 2018 03:19:14
>> Objet: Re: enhanced for loop with multiple iteration variables
>
>> RIght, but I don’t see that as a general solution.
- Mail original -
> De: "Alan Snyder"
> À: "Brian Goetz"
> Cc: "core-libs-dev"
> Envoyé: Vendredi 21 Décembre 2018 03:19:14
> Objet: Re: enhanced for loop with multiple iteration variables
> RIght, but I don’t see that as a general soluti
- Mail original -
> De: "Alan Snyder"
> À: "Remi Forax"
> Cc: "core-libs-dev"
> Envoyé: Vendredi 21 Décembre 2018 03:20:46
> Objet: Re: enhanced for loop with multiple iteration variables
> Lambdas are clean, but limited in current Java c
.
> });
>
> Rémi
>
> - Mail original -
>> De: "Brian Goetz"
>> À: "Alan Snyder" , "core-libs-dev"
>>
>> Envoyé: Jeudi 20 Décembre 2018 23:50:15
>> Objet: Re: enhanced for loop with multiple iteration variables
>
RIght, but I don’t see that as a general solution.
Its also a bit kludgy, like saying that methods need only one parameter because
you can always pass a data object.
> On Dec 20, 2018, at 2:50 PM, Brian Goetz wrote:
>
> For Map, you can do:
>
> for (Map.Entry e : map.entrySet()) { ... }
>
or
map.forEach((key, value) -> {
...
});
Rémi
- Mail original -
> De: "Brian Goetz"
> À: "Alan Snyder" , "core-libs-dev"
>
> Envoyé: Jeudi 20 Décembre 2018 23:50:15
> Objet: Re: enhanced for loop with multiple iteration variables
For Map, you can do:
for (Map.Entry e : map.entrySet()) { ... }
and you're already there.
On 12/19/2018 9:54 AM, Alan Snyder wrote:
Has any consideration been given to supporting iterators that provide more than
one iteration variable in the enhanced for loop?
Obvious uses would be map
Has any consideration been given to supporting iterators that provide more than
one iteration variable in the enhanced for loop?
Obvious uses would be maps (keys and values) and lists (indexes and values).
I have in mind keeping the syntactic sugar approach by using one or more
extensions of th