@@ -0,0 +1,990 @@
+package java_problems.object_oriented_programming;%0D%0A%0D%0Aimport java.util.*;%0D%0A%0D%0Apublic class JavaIterator %7B%0D%0A%0D%0A%09static Iterator func(ArrayList mylist)%0D%0A%09   %7B%0D%0A%09      Iterator it=mylist.iterator();%0D%0A%09      while(it.hasNext())%0D%0A%09      %7B%0D%0A%09         Object element = it.next();%0D%0A%09         if(element instanceof String) %7B%0D%0A%09            break;%0D%0A%09         %7D%0D%0A%09      %7D%0D%0A%09      return it;%0D%0A%09      %0D%0A%09   %7D%0D%0A%0D%0A%09   public static void main(String %5B%5Dargh)%0D%0A%09   %7B%0D%0A%09      ArrayList mylist = new ArrayList();%0D%0A%09      Scanner sc=new Scanner(System.in);%0D%0A%09      int n=sc.nextInt();%0D%0A%09      int m=sc.nextInt();%0D%0A%09      for(int i=0;i%3Cn;i++)%0D%0A%09      %7B%0D%0A%09         mylist.add(sc.nextInt());%0D%0A%09      %7D%0D%0A%09      mylist.add(%22###%22);%0D%0A%09      for(int i=0;i%3Cm;i++)%0D%0A%09      %7B%0D%0A%09         mylist.add(sc.next());%0D%0A%09      %7D%0D%0A%09      %0D%0A%09      %0D%0A%09      Iterator it=func(mylist);%0D%0A%09      while(it.hasNext())%0D%0A%09      %7B%0D%0A%09         Object element = it.next();%0D%0A%09         System.out.println((String)element);%0D%0A%09      %7D%0D%0A%09      %0D%0A%09   %7D%0D%0A%7D

Add JavaIterator