Question: In java TASK: Create a class called ListPrint with the following overloaded static print methods: One version that has a single parameter of type LinkedList
In java
TASK: Create a class called ListPrint with the following overloaded static print methods: One version that has a single parameter of type LinkedList called strings, and it should print the elements of strings as follows (no spaces between elements): (First) ->(Second) ->(Third)... One version that has a single parameter of type ArrayList called strings, and it should print the elements of strings as follows (no spaces between elements): [First] [Second] (Third]... One version that has a single parameter of type Iterable called strings, and it should print the elements of strings as follows (no spaces between elements): First, Second, Third,... One version that has a parameter of type Iterable called strings followed by a parameter of type String called delim, and it should print the elements of strings separated by delim. For example, if delim is"": First Second Third ... Each of these methods must end the line. For example, if I call any of these methods 4 times, I should have 4 lines of printed output. You can also assume that the argument will be non-empty HINT: You do not need to use an Iterator for this question: recall that any class that implements the Iterable interface can be traversed using a for-each loop, such as the following: public void printElements (Iterable elements) { for(String element : elements) { System.out.println(element); Sample Input: Gandalf Frodo Sam Aragorn Legolas Gimli Pippin Merry Boromir Sample Output: (Gandalf)->(Frodo)->(Sam) ->(Aragorn)->(Legolas)->(Gimli)->(Pippin) ->(Merry)-> (Boromir) [Gandalf][Frodo] (Sam][Aragorn] (Legolas] [Gimli][Pippin] (Merry][Boromir] Gandalf, Frodo, Sam, Aragorn, Legolas, Gimli, Pippin, Merry, Boromir Gandalf--Frodo--Sam--Aragorn--Legolas--Gimli--Pippin--Merry--Boromir