Java examples for java.util:List Duplicate Element
fill List with duplicate elements
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static <A> List<A> fillList(int size, A item) { List<A> l = new ArrayList<A>(size); for (int i = 0; i < size; ++i) l.add(item);//w w w. j a v a 2 s . c o m return l; } }