Java tutorial
//package com.java2s; import java.util.ArrayList; public class Main { public static <T> ArrayList<T> alistInit(T value, int size) { ArrayList<T> ret = new ArrayList<T>(size); for (int i = 0; i < size; i++) ret.add(value); return ret; } }