Java tutorial
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; public class Main { final static public int INITIAL_CAPACITY = 20; final static public List<Object> synchronizedList(final int size) { return Collections.synchronizedList(createList(size)); } final static public List<Object> synchronizedList() { return synchronizedList(INITIAL_CAPACITY); } final static public List<Object> createList() { return createList(INITIAL_CAPACITY); } final static public List<Object> createList(int size) { return size > 0 ? new ArrayList<Object>(size) : createList(); } final static public List<Object> createList(Collection<Object> collection) { return new ArrayList<Object>(collection); } }