ittimepass.com
Write a program in java to demonstrate List Iterator? ⋆ IT TIME PASS
import java.util.*; public class CollectionList { public static void main(String arg[]) { ArrayList ls=new ArrayList(); ls.add("Vikrant"); ls.add("Sunny"); ls.add("Kanir"); ls.add(1,"Abhinandan"); ls.add("Kundan"); System.out.println("Total Number of elements is "+ls.size()); System.out.println(ls.contains("Sunny")); System.out.println(ls.contains("Vikash")); Iterator itr=ls.iterator(); while(itr.hasNext()) { System.out.println("\t"+itr.next()); } ls.remove("Kanir"); System.out.println("Total Number …