Java Vector containsAll() MethodThe containsAll() method of Java Vector class is used to check the vector which is in use contains all of the elements in the specified Collection or not. It returns true if this vector contains all of the elements in the Collection, otherwise returns false. Syntax:Following is the declaration of containsAll() method: Parameter:
Returns:The containsAll() method returns true if this vector contains all of the elements in the specified collection. Exceptions:NullPointerException- This method has thrown an exception if the specified collection is null. Compatibility Version:Java 1.2 and above Example 1:Test it NowOutput: Does vector contains all list elements?: true Does vector contains all list elements?: false Example 2:Test it NowOutput: Existence: true Existence: false Example 3:Test it NowOutput: Exception in thread "main" java.lang.NullPointerException at java.base/java.util.Vector.<init>(Vector.java:178) at myPackage.VectorContainsAllExample3.main(VectorContainsAllExample3.java:6)
Next TopicJava Vector
|