isSuperset<T> function
- Eq<
T> eq
Determines whether one list is a superset of another list.
A superset means that all elements in the second list (potential subset) are contained in the first list (potential superset).
The function leverages an Eq instance to determine equality between elements.
Example:
final eqInt = Eq<int>((a, b) => a == b);
final list1 = ImmutableList([1, 2, 3, 4, 5]);
final list2 = ImmutableList([1, 2, 3]);
final check = isSuperset(eqInt)(list1);
assert(check(list2) == true); // because list1 is a superset of list2
Eq: A type class that defines how to compare the equality of two values of the same type.
Implementation
bool Function(ImmutableList<T> set) Function(ImmutableList<T> supersetCandidate)
isSuperset<T>(Eq<T> eq) {
return flip(isSubset(eq));
}