Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { public static <T> List<T> asUnmodifiableList(@SuppressWarnings("unchecked") T... ts) { List<T> l = new ArrayList<>(); for (T t : ts) { l.add(t); } return Collections.unmodifiableList(l); } }