Java tutorial
import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { public static void main(String args[]) { List<String> arlst = new ArrayList<String>(); arlst.add("A"); arlst.add("B"); arlst.add("C"); arlst.add("from java2s.com"); // create typesafe view of the list List<String> tslst = Collections.checkedList(arlst, String.class); System.out.println(tslst); } }