Help the world stop coronavirus! Stay home!

Prev Next

Java / List and its implementations

Java Collection: Difference between ArrayList.clear() and ArrayList.removeAll().

ArrayList.clear() will traverse the underlying Array and set each entry to null that eventually removes all the elements of ArrayLIst.

removeAll(collection) traverse through the ArrayList comparing for collection and remove the element, if it exists.

ArrayList.clear() is comparatively faster as it does not perform any comparison.

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...

Map and its implementations

Comments & Discussions