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