Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; public class Main { public static <T> List<T> unmodifiableArrayList(Collection<T> elements) { return Collections.unmodifiableList(new ArrayList<T>(elements)); } public static <T> List<T> unmodifiableArrayList(Collection<? extends T> elements, Class<T> castClass) { return Collections.unmodifiableList(new ArrayList<T>(elements)); } }