O método containsAll() do Java Set é usado para verificar se dois conjuntos contêm os mesmos elementos ou não. Ele pega um conjunto como parâmetro e retorna Verdadeiro se todos os elementos deste conjunto estiverem presentes no outro conjunto.

Sintaxe:

public boolean containsAll(Collection C)

Parâmetros: O parâmetro C é uma coleção. Este parâmetro refere-se ao conjunto cuja ocorrência dos elementos deve ser verificada neste conjunto.

Valor de retorno: O método retorna True se este conjunto contém todos os elementos de outro conjunto, caso contrário, retorna False.

Os programas abaixo ilustram o método Set.containsAll():

Programa 1:

// Java code to illustrate
// Set containsAll()
  
import java.util.*;
  
class SetDemo {
    public static void main(String args[])
    {
  
        // Creating an empty set
        Set<String>
            set = new HashSet<String>();
  
        // Use add() method to
        // add elements in the set
        set.add("Geeks");
        set.add("for");
        set.add("Geeks");
        set.add("10");
        set.add("20");
  
        // prints the set
        System.out.println("Set 1: "
                           + set);
  
        // Creating another empty set
        Set<String>
            set2 = new HashSet<String>();
  
        // Use add() method to
        // add elements in the set
        set2.add("Geeks");
        set2.add("for");
        set2.add("Geeks");
        set2.add("10");
        set2.add("20");
  
        // prints the set
        System.out.println("Set 2: "
                           + set2);
  
        // Check if the set
        // contains same elements
        System.out.println("\nDoes set 1 contains set 2?: "
                           + set.containsAll(set2));
    }
}
Saída:
Conjunto 1: [Geeks, for, 20, 10]
Conjunto 2: [Geeks, for, 20, 10]

O conjunto 1 contém o conjunto 2 ?: verdadeiro

Programa 2:

// Java code to illustrate boolean containsAll()
  
import java.util.*;
  
class SetDemo {
    public static void main(String args[])
    {
  
        // Creating an empty set
        Set<String>
            set = new HashSet<String>();
  
        // Use add() method to
        // add elements in the set
        set.add("Geeks");
        set.add("for");
        set.add("Geeks");
  
        // prints the set
        System.out.println("Set 1: "
                           + set);
  
        // Creating another empty set
        Set<String>
            set2 = new HashSet<String>();
  
        // Use add() method to
        // add elements in the set
        set2.add("10");
        set2.add("20");
  
        // prints the set
        System.out.println("Set 2: "
                           + set2);
  
        // Check if the set
        // contains same elements
        System.out.println("\nDoes set 1 contains set 2: "
                           + set.containsAll(set2));
    }
}
Saída:
Conjunto 1: [Geeks, para]
Conjunto 2: [20, 10]

O conjunto 1 contém o conjunto 2: falso

Referência : https://docs.oracle.com/javase/7/docs/api/java/util/Set.html#containsAll(java.util.Collection)