I have 10 array lists and a String variable. I have one function/method that allows the user to select one of the array lists to add to. Currently, that function changes the value of a string "chosen" to the value of the proper array list name.
Another function is started in which adding elements to the arraylist happens. However, I am struggling to come up with a solution on how to change which arraylist is being added to based upon what was selected by the user.
This code doesn't work but say it was:
chosen.add(whatUserEntered);
Normally you can put in the arrayList name and add .add(whateverTheUserIsEntering) and itll work fine.
So how can I have the name of an arrayList equal that of a String variable's value?