I am new to Java. I am working with ArrayLists and have a couple of questions in that. So here goes..
#1. I have an ArrayList and I keep adding Strings to it. Upon a certain condition, I add this ArrayList to an ArrayList of ArrayLists like this
In this code, when removeLastElement() is executed, the elements in arr as well as arrOfArr are removed. Is there a way to remove elements from arr but leave arrOfArr intact?Code:
ArrayList<String> arr = new ArrayList<String>();
ArrayList<ArrayList> arrOfArr = new ArrayList<ArrayList>();
public void startElement (String tagName)
public void endElement ()
public void removeLastElement ()
public static void main(String args)
Test test = new Test();
#2. In the above code, is there a way to convert arrOfArr to a String without iterating through arrOfArr element by element?