We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
static Iterator func(ArrayList mylist){
Iterator it=mylist.iterator();
while(it.hasNext()){
Object element = it.next();
if(element.toString().contains("###"))//Hints: use instanceof operator
break;
}
return it;
}
@SuppressWarnings({ "unchecked" })
public static void main(String []args){
ArrayList mylist = new ArrayList();
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
for(int i = 0;i
Java Iterator
You are viewing a single comment's thread. Return to all comments →
import java.util.*; public class Main{
static Iterator func(ArrayList mylist){ Iterator it=mylist.iterator(); while(it.hasNext()){ Object element = it.next(); if(element.toString().contains("###"))//Hints: use instanceof operator
} @SuppressWarnings({ "unchecked" }) public static void main(String []args){ ArrayList mylist = new ArrayList(); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); for(int i = 0;i
} }