Java
자바 List 순회
[하마] 이승현 (wowlsh93@gmail.com)
2015. 5. 12. 16:30
- For loop
- For loop (Advance) (앵간하면 이거 쓰자)
- While loop
- Iterator loop
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i));
}
for (String temp : list) {
System.out.println(temp);
}
int j = 0;
while (list.size() > j) {
System.out.println(list.get(j));
j++;
}
Iterator<String> iterator = list.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next());
}