Which is the best practice between
ArrayList.clear();
new ArrayList<Object>();
I have a list which gets data, I use them and then I have to recycle it. Which is the best way?
Which is the best practice between
ArrayList.clear();
new ArrayList<Object>();
I have a list which gets data, I use them and then I have to recycle it. Which is the best way?
I think if u just clear it its 1 less object for GC to handle, so its better.
I dont see any actual advantage on creating a new array list object if not changing the type.