I know four ways to do this… But which way is the best?
- Using an iterator
- Using a for loop with array.size() as the max value
- Using array.toArray(new [0]);
- Just using for ( val : array) {} (this actually works!)
Just as a note, I will be iterating through it a lot so what is actually the best way which is easiest and the best?