isSuperset<T> function

bool isSuperset<T>(
  1. Set<T> a,
  2. Set<T> b
)

Checks if set a is a superset of set b.

Returns true if all elements of b are contained in a.

Time Complexity: O(n), where n is the size of b. Space Complexity: O(1)

Example:

bool result = isSuperset({1, 2, 3}, {2, 3});
print(result); // Outputs: true

Implementation

bool isSuperset<T>(Set<T> a, Set<T> b) => a.containsAll(b);