(Solved) : Given Two Sorted Lists L1 L2 Complete Following Procedure Java Compute L1 L2 X 1 X L1 Xe L Q27212614 . . .

Given two sorted lists, L1 and L2, complete a following procedure in Java to compute: (a) L1 L2 = { x 1 x L1 and XE L2 } using only the basic list operators (next(), hasNext(), and compareTo)) and one loop. public static <AnyType extends Comparable<? super AnyType> void difference(ListcAnyType» L1, List<AnyType> L2, List<AnyType> Difference) ListIterator«AnyType> iterL1 = Ll.list Iterator(); ListIterator«AnyType> iterL2 = L2.1istlterator(); if (iterL1.hasNext) && iterL2.hasNext)) itemL1 itemL2 iterL1.next(); iterL2.next(); · = I YOUR CODE GOES HERE (b) L1 n L2 = { x 1 x L1 and x E L2) using only the basic list operators (next(), hasNext(), and compareTo()) and one loop. public static <AnyType extends Comparable<? super AnyType void intersection (List<AnyType L1, List<AnyType L2, List<AnyType Intersect) ListlteratorAnyType> iterL1- し1.list Iterator(); ListlteratorcAnyType> iterL2 = L2.list Iterator(); if (iterL1.hasNext()&& iterL2.hasNext)) itemし1 iterL1.next(); = // YOUR CODE GOES HERE Show transcribed image text
Expert Answer
Answer to Given Two Sorted Lists L1 L2 Complete Following Procedure Java Compute L1 L2 X 1 X L1 Xe L Q27212614 . . .
OR