比较两个集合元素是否相同? menuSearches.sort(Comparator.comparing(String::hashCode)); 先对集合中的元素进行排序,排序后,转成String类型,然后使用equals进行比较