Design and analyze and code a method for generic mArrayList that will manipulate tge linkedlist
import java.util.*;
public class mArrayList {
public static void main(String args[])
{
LinkedList<String> element
= new LinkedList<String>();
System.out.println("Adding elements");
element.add("1");
element.add("2");
element.addLast("3");
element.addFirst("4");
element.add(2, "5");
System.out.println(element);
System.out.println("Removing elements");
element.remove("2");
element.remove(3);
element.removeFirst();
element.removeLast();
System.out.println(element);
}
}
Comments
Leave a comment