Remove the same

Report a typo

You're working with two lists: LinkedList and ArrayList that contain String elements.

You need to implement the removeTheSame method. It should remove equal elements at equal indexes.

Note that both lists always have the same size.

Example:

// original lists

LinkedList [a, b, c, d, e, f]
ArrayList  [a, 1, 2, 3, 4, f]

// after removeTheSame method invocation

LinkedList [b, c, d, e] 
ArrayList  [1, 2, 3, 4]
Write a program in Java 17
import java.util.*;

class ListOperations {
public static void removeTheSame(LinkedList<String> linkedList, ArrayList<String> arrayList) {
// write your code here
}
}
___

Create a free account to access the full topic