How to separate ArrayLists in memory?
My name is David and i have a problem with usage of ArrayLists.
In my program i have defined two ArrayLists as follows:
private ArrayList<Tour> ToursCR;
private ArrayList<Tour> ToursUCC;
In the constructor i initialize them as follows:
this.ToursCR = new ArrayList<Tour>();
this.ToursUCC = new ArrayList<Tour>();
In a separate method i try to fill the ArrayLists:
The output is was expecting was that ToursCR and ToursUCC would have different values. Which should also be the case because completely different values are obtained from the methods.
However, after the ArrayList both should have been assigned values it appears that they both have the value of "ToursUCC".
How can i make sure that each ArrayList contains the data it should contain?
Re: How to separate ArrayLists in memory?
This looks like an issue with what the two methods are returning. If you can't spot anything, try do a system.out of everything which is being returned by each of these methods and confirm it is different.