Question: Java expert please help me the JAVA program below? please create your own code. DON'T copy any code from anywhere, that's why I am asking
Java expert please help me the JAVA program below?

please create your own code. DON'T copy any code from anywhere, that's why I am asking for help here.
Sample code from instructor lecture, please make your code like the way of sample code does
---------CollForLoop.java---------
import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; public class CollForLoop { public static void main(String[] args) { System.out.println("for loop Collection"); Collection coll = ListGen.genCollection(); for (String s : coll) { System.out.println(s); } System.out.println(" for loop List"); List lis = ListGen.genList(); for (String s : lis) { System.out.println(s); } System.out.println(" for loop LinkedList"); LinkedList lis2 = ListGen.genLinkedList(); for (String s : lis2) { System.out.println(s); // if (s.equals("sally")) lis2.remove(s); } System.out.println(" Iterator Collection"); Collection c = ListGen.genCollection(); Iterator it = c.iterator(); while (it.hasNext()) { String s = it.next(); if ("jack".equals(s)) { // it.remove(); } System.out.println(s); } System.out.println(c); System.out.println(" Iterator List"); List l = ListGen.genList(); Iterator lit = l.iterator(); while (lit.hasNext()) { String s = lit.next(); System.out.println(s); } System.out.println(" Iterator LinkedList"); LinkedList ll = ListGen.genLinkedList(); Iterator llit = ll.iterator(); while (llit.hasNext()) { String s = llit.next(); System.out.println(s); if ("jack".equals(s)) { llit.remove(); } } System.out.println(ll); System.out.println(" ListIterator List"); List l2 = ListGen.genList(); ListIterator l2it = l2.listIterator(); while (l2it.hasNext()) { String s = l2it.next(); System.out.println(s); } System.out.println(" Iterator LinkedList"); LinkedList lll = ListGen.genLinkedList(); ListIterator lllit = lll.listIterator(); while (lllit.hasNext()) { String s = lllit.next(); System.out.println(s); if ("jack".equals(s)) { String s2 = lllit.previous(); System.out.println("backed up once: " + s2); s2 = lllit.previous(); System.out.println("removing " + s2); lllit.remove(); lllit.next(); } } System.out.println(" after removal"); System.out.println(lll); } }
-----Another sample code--------
-----ListGen.java-----
import java.util.Arrays; import java.util.Collection; import java.util.LinkedList; import java.util.List; public class ListGen { public static Collection genCollection() { Collection c = Arrays.asList(genVals()); return c; } public static List genList() { return Arrays.asList(genVals()); } public static LinkedList genLinkedList() { LinkedList ll = new LinkedList(); ll.addAll(Arrays.asList(genVals())); return ll; } private static String[] genVals() { String[] sa = { new String("sophie"), new String("sally"), new String("jack"), new String("sally"), }; return sa; } } (Match grouping symbols) A Java program contains various pairs of grouping symbols, such as: L Parentheses C and D L Braces and H L Brackets C and Note that the grouping symbols cannot overlap. For example, Ca{b) is illegal Write a program to check whether a Java source-code file has correct pairs of grouping symbols. Pass the source-code file name as a command-line argument
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
