![]() |
Compare Just Created ArrayList to the one before
Hi,
I am having trouble figuring out how to compare each individual value of the ArrayList. I do this by assigning an empty ArrayList before the ArrayList I am about fill in but for some reason it fills both at the same time when I run the method. Do any of you have an idea why? Note: this code is not doing comparison but I can't fill them right in the first place to attempt to do comparison. Code:
StationsArrayListG7a = StationsArrayListG7;. I tried copy and stuff like that but it kept giving me null. Thanks in advance. |
That's exactly why they are the same. You are assigning StationsArrayListG7a the value of StationsArrayListG7, and then assigning StationsArrayListG7 items. Both StationsArrayListG7a and stationsArrayListG7 point at the same object, so they both retrieve the same results. Remove this assignment
StationsArrayListG7a = StationsArrayListG7;, and they will point at the same list. I assume that your generic instantiation is of type Long as well; that will throw a compilation failure otherwise. |
| All times are GMT +1. The time now is 06:19 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.