Vector containsAll() Method in Java
The java.util.vector.containsAll() method is used to check to check if this Vector contains all of the elements in the specified Collection. So basically it is used to check if a vector contains a set of elements or not.
Parameters: This method accepts a mandatory parameter col which is of the type of vector. This is the collection whose elements are needed to be checked if it is present in the vector or not.
Return Value: The method returns True if all elements in the collection col are present in the vector otherwise it returns False.
Exception: The method throws NullPointerException if the specified collection is NULL.
Below programs illustrates the Java.util.Vector.containsAll() method:
Vector: [Welcome, To, Geeks, 4, Geeks] Are all the contents equal? true Are all the contents equal? false
Vector: [10, 15, 30, 20, 5] Vector: [10, 15, 30, 20, 5] Are all the contents equal? false Are all the contents equal? true
My Personal Notes arrow_drop_up
Please Login to comment...