0

Can anyone please explain to me what this piece of code is trying to do and how it cycles through?

for(E a : this) <-------- This code right here.
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
Jerry
  • 11
  • It is called enhanced for loop. It lets you iterate over any `Iterable` with `for (E element : somethingIterable)` or arrays `Type[]` with `for (Type t : arrayOfType)` http://docs.oracle.com/javase/1.5.0/docs/guide/language/foreach.html – Pshemo Feb 24 '15 at 04:05
  • It is a "for each" loop in an instance method in an object of a class that implements `Iterable`. – Sergey Kalinichenko Feb 24 '15 at 04:06
  • Another form of a for loop. We call it the for each loop. Probably the simplest way to iterate over an array or a list. Within the for each you could just do a[dot][number] to get a particular element in the list. – A1ternat1ve Feb 24 '15 at 05:06

0 Answers0