본문 바로가기

프로그래밍/java

Iterator


Collection에 저장된 요소들을 출력하기 위한 코드 


List list = new Arraylist(); //다른 컬렉션으로 변경해서 활용 list, set, map
Iterator it = list.iterator();
while(it.hasNext())

{
System.out.println(it.next());
}

'프로그래밍 > java' 카테고리의 다른 글

LocalDate, LocalTime 시간 비교  (0) 2023.10.17
Exception source  (0) 2019.11.13
String , StringBuffer, StringBuilder  (1) 2019.11.13
Hashtable 객체 출력에서 생기는 오류  (2) 2019.11.13