Hi I was wondering if I could assign a ArrayList to another ArrayList (like a pointer?) in Java.
Here is a example to illustrate my point
public class FooBar
{
boolean Foo = true;
public ArrayList<String> listA = new ArrayList<String>();
public ArrayList<String> listB = new ArrayList<String>();
public void Bar()
{
ArrayList<String> whichList;
if(Foo)
whichList = listA;
else
whichList = listB;
for( String words : whichList )
{
// ...
}
}
}
Would this work?