iterable1 Iterator,Iterable 자바에서는 ArrayList,LinedList등 자료를 탐색할 수 있는 Collection이 존재한다. 하지만 이런 Collection들은 탐색방법을 우리가 임의로 정하지 못한다. 예를들어 총 10개가 저장돼있는 선형적 자료구조에서 짝수번째만 보고싶다하더라도 for,forEach를 통해 인덱스를 홀수번째라면 건너뛰고 확인해야 한다. public class Main { public static void main(String[] args) { ArrayList test=new ArrayList(); test.add("사과"); test.add("딸기"); test.add("오렌지"); test.add("포도"); test.add("참외"); test.add("파인애플"); for(int i=0;i 2021. 2. 13. 이전 1 다음