Java Vector removeAll() MethodThe removeAll() method of Java Vector class deletes all the elements from the vector that are present in the specified collection. SyntaxFollowing is the declaration of removeAll() method: Parameter
ReturnThe removeAll() method returns true if the vector changed as a result of the call. ExceptionsNullPointerException- This method has thrown an exception if the vector contains one or more null elements and the specified collection does not support null elements or if the specified collection is null. Compatibility VersionJava 1.2 and above Example 1Test it NowOutput: Vector: [1, 2, 3, 4, 5] Removing all the elements Size of the vector: 0 Example 2Test it NowOutput: Vector: [A, B, C, 10, 20] Collection removed Final Vector: [10, 20] Next TopicJava Vector |
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