I`ve two methods to discharge an ArrayList in java:
1- re-assign the list object.
list = new ArrayList();
2- using clear method.
list.clear();
Which is better?
I`ve two methods to discharge an ArrayList in java:
1- re-assign the list object.
list = new ArrayList();
2- using clear method.
list.clear();
Which is better?
If you have a large arraylist it may be faster to make a new arraylist than using clear. http://www.docjar.com/html/api/java/util/ArrayList.java.html