Java ArrayList removeAll() MethodLast Updated : 17 Mar 2025 The removeAll() method of Java ArrayList class removes all the elements from a list that are contained in the specified collection. Syntax:Parameter:"c": collection that contained elements to be removed from this list. Return:True if the original list changed as a result of this call. Exception:java.lang.NullPointerException: If the specified collection is null, or if the original list contains null elements and the specified collection does not permit null elements. ClassCastException: if the class of an element of the original list is incompatible with the specified collection. Example 1Output: [A, B, C, D, E] [C, D, E] true [A, B] Example 2Output: [A, B, C, D] Example 3Output: null [a, b] Next TopicJava ArrayList |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India