java8 stream()中distinct()用在List<Map<String, String>> 类型中
distinct()会判断每个Map<>中的所有元素是否相等吗?
是,因为HashMap继承AbstractMap,然后AbstractMap重写了equals方法。distinct()使用 hashCode() 和 eqauls() 方法来获取不同的元素。因此,需要去重的类必须实现 hashCode() 和 equals() 方法。所以可以通过distinct()为HashMap去重****。