Java tutorial
import java.util.Collections; import java.util.Iterator; import java.util.List; public class Main { public static void main(String[] args) { List list = Collections.nCopies(5, "A"); Iterator itr = list.iterator(); while (itr.hasNext()) System.out.println(itr.next()); } } /* A A A A A */