Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsCheckedCollectionExample1 { public static void main(String[] args) { //Create list ArrayList
arrlist = new ArrayList
(); arrlist.add("A"); arrlist.add("B"); arrlist.add("C"); arrlist.add("D"); //Create type safe view of the collection Collection
tslist; tslist = Collections.checkedCollection(arrlist,String.class); System.out.println("Type safe view is: "+tslist); } }
Output