Java ArrayList removeAll() MethodThe 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 1Test it NowOutput: [A, B, C, D, E] [C, D, E] true [A, B] Example 2Test it NowOutput: [A, B, C, D] Example 3Test it NowOutput: null [a, b] Next TopicJava ArrayList |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India