Assuming that arraylist
is defined as ArrayList<String> arraylist
, is arraylist.removeAll(arraylist)
equivalent to arraylist.clear()
?
If so, can I assume that the clear()
method is more efficient for emptying the array list?
Are there any caveats in using arraylist.removeAll(arraylist)
instead of arraylist.clear()
?
arraylist.removeAll(arraylist)
? I see absolutely no reason to do that. – RetaliationelementData[i] = null
ande.remove()
significant? – PlayboyarrList.removeAll(arrList)
instead ofarrList.clear()
.arrList1.removeAll(arrList2)
is a different matter. – Constituencyif (c == this && !isEmpty()) { clear(); return true; }
. I'll have to submit this to OpenJDK as a patch! ;-) – Snafflearraylist.removeAll(arraylist)
instead ofarraylist.clear()
"? – Maugham