import java.util.*; class HW4Lists { public static List union(List lst1, List lst2) { // Should return the union of the two sorted lists, with no duplicates } public static List intersect(List lst1, List lst2) { // Should return the intersection of the two sorted lists, with no duplicates } public static void main( String [] args) { int j; ArrayList firstList = new ArrayList(); for (int i = 0; i < 20; i++) { j = (int) (100 * Math.random()); if (j < 50) { firstList.add(i); } } System.out.println(firstList); ArrayList secondList = new ArrayList(); for (int i = 0; i < 20; i++) { j = (int) (100 * Math.random()); if (j < 50) { secondList.add(i); } } System.out.println(secondList); List mergedList = union(firstList,secondList); System.out.println(mergedList); List commonList = intersect(firstList, secondList); System.out.println(commonList); } }