java - Is it possible to rename an ArrayList? -


I was wondering if there is a way to rename allocated variables to an ArrayList ... or if I'm just another Make it just by doing exactly that.

Just create a new reference with the name that you want and assign it from the old context: < / P>

  ArrayList original = ...; ArrayList newList = Original;  

I should point out that because ArrayList is a reference type, the original and newList both point to similar data in memory. If you add an item to the original or new list, it is affecting both. This is not making a second copy of ArrayList if you are talking about re-processing your code to change the name of the variable in the whole application, then it is a bit difficult to understand. Then, how it depends on the IDE you are using? , But any good IDE will have this capability.


Comments