// Create a class that represents a list of Strings using ArrayList // write methods to allow user programs to insert and remove items at the front, end and anywhere using an index, also destroy the list and return the ArrayList import java.util.*; public class MyList { protected ArrayList alist; public MyList() { alist=new ArrayList(); } public void insertAtEnd(String a) { alist.add(a); } public void insertAtFront(String a) { alist.add(0, a); } public ArrayList getList() { return alist; } public void destroy() { alist=new ArrayList(); } public void insert(int i, String a) { alist.add(i, a); } public String removeFromFront() { String temp = null; if(!alist.isEmpty()) { temp = alist.get(0); alist.remove(0); } else System.out.println("Empty list"); return temp; } public String removeFromEnd() { String temp=null; if(!alist.isEmpty()) { temp = alist.get(alist.size()-1); alist.remove(alist.size()-1); } else System.out.println("Empty list"); return temp; } public String remove(int i) { String temp = null; if(alist.size()>i) { temp = alist.get(i); alist.remove(i); } else System.out.println(i + " is out of bounds"); return temp; } }