package com.sourcefellows.patterns.iterator;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Main {

    public static void main(String[] args) {

        List<String> arrayList = new ArrayList<>();
        arrayList.add("Hello World");

        Iterator<String> iterator = arrayList.iterator();

        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }

        for (String s : arrayList) {
            System.out.println(s);
        }
    }

}

