The big merge

Report a typo

You're working with the two lists: LinkedList and ArrayList filled with String elements.

You need to implement the mergeLists method, that should

  1. Add all elements from the ArrayList to the end of the LinkedList

  2. Print the new size of the LinkedList, like this: The new size of LinkedList is 10

  3. Print the linked list using the following format: [item1, item2, item3, item4]

Sample Input 1:

a b c d e
f g h i j

Sample Output 1:

The new size of LinkedList is 10
[a, b, c, d, e, f, g, h, i, j]
Write a program in Java 17
class ListOperations {
public static void mergeLists(LinkedList<String> linkedList, ArrayList<String> arrayList) {
// write your code here

}
}
___

Create a free account to access the full topic