![]() |
VOOZH | about |
The containsAll() method of Set in Java is used to check if a collection contains all the elements of a specified collection. This method is part of the Collection interface.
Example 1: This example checks if all elements of one set are present in another set and it will return true if they are identical.
Set 1: [Java, C++, Python] Set 2: [Java, C++, Python] Does set 1 contains set 2?: true
boolean containsAll(Collection<?> c)
Example 2: This example checks if all elements of one set are present in another set and it will return false if they are not identical.
Set 1: [Java, C++, Python] Set 2: [20, 10] Does s1 contain all elements of s2: false