List supersets

The other approach is to use the isSuperset() method, which determines if the argument is a subset of the collection where we're calling the method:

const myList = List.of(
List.of(1, 2, 3),
List.of(4, 5, 6),
List.of(7, 8, 9)
);
const isSuperset = myList
.flatten()
.isSuperset(List.of(2, 5, 8));

console.log('isSuperset', isSuperset);
// -> isSuperset true

As you can see, this is just another way of getting the same result as the prior example.

As a rule of thumb, if a collection is a subset of another collection, then the other collection is a superset. If a collection is a superset of another collection, then the other collection is a subset.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.161.225