mardi 27 juin 2017

Is statement in for each loop executed each iteration? [duplicate]

This question already has an answer here:

I have a function which returns a container. Let's just call it 'Container'.

Container GenerateRandomContainer() { ... }

This function will generate a container with random elements that are different each call.

When I iterate through this container using a for each loop like this:

for(Element e : GenerateRandomContainer()) { ... }

Will it generate a new Container each iteration or will it generate only one when the for each loop is entered?

Aucun commentaire:

Enregistrer un commentaire