Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <T> List<T> asConstList(T... in) { return Collections.unmodifiableList(Arrays.asList(Arrays.copyOf(in, in.length))); } public static <T> List<T> asConstList(Collection<T> in) { ArrayList<T> ret = new ArrayList(in); ret.trimToSize(); return Collections.unmodifiableList(ret); } }