Say I have a list of strings or whatever really. Then say I want to use ONE of the strings multiple times in the next bit of code. Should I create a new String variable foo String foo = list.get(position) and use foo in the following code, or should I save the memory space and use list.get(position) every time I need to use that string? Or are they actually the same thing under the hood?
Would the answer change if the list contained a more complicated class that might do a lot of computations to instantiate or have a lot of variables in itself so creating a new one takes up a lot of memory?