您可以将a转换为小写字符串的HashSet,这样可以更快地检查子集(因为它需要花费一些时间来检查b的任何元素是否属于aset,而不是检查包含在内的所需的线性时间一个列表):
Set aset = a.stream().map(String::toLowerCase).collect(Collectors.toCollection(HashSet::new));
boolean subset = b.stream().map(String::toLowerCase).allMatch(aset::contains);
P.S.,您正在使用术语子集,但实际上您要检查的不是一个List是否是另一个List的子集,因为您的列表不是集合,这意味着它们可能包含重复值.首先从集合开始会更有意义.
编辑:
如果使用containsAll似乎对你更好,至少在两个集合而不是两个列表上运行它.您将获得线性运行时间而不是二次运行时间:
Set aset = a.stream().map(String::toLowerCase).collect(Collectors.toCollection(HashSet::new));
Set bset = b.stream().map(String::toLowerCase).collect(Collectors.toCollection(HashSet::new));
boolean subset = aset.containsAll(bset);