List<String> result = Stream.of(Lists.newArrayList("1", "1", "3"), Lists.newArrayList("1", "2")) .flatMap(Collection::stream).distinct().collect(Collectors.toList());
代码很优雅,但是要合并的list内元素是对象需要equals和hashcode方法
List<String> result = Stream.of(Lists.newArrayList("1", "1", "3"), Lists.newArrayList("1", "2")) .flatMap(Collection::stream).distinct().collect(Collectors.toList());
代码很优雅,但是要合并的list内元素是对象需要equals和hashcode方法