/**
* @author lautturi.com
* Java example:iterate over array in java
*/
import java.util.*;
public class Lautturi {
public static void main(String[] args) {
Integer[] myArray = { 11, 4, 2, 7, 55, 16, 12, 8, 13, 38 };
Iterator<Integer> iterator = Arrays.stream(myArray).iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next());
}
}
}Source:www.lautturi.comoutput:
11 4 2 7 55 16 12 8 13 38