对象数组过滤相同的属性

75 阅读1分钟
List<String> list = linkPersonVoList.stream()
        .collect(Collectors.groupingBy(linkPersonVo -> linkPersonVo.getName(),Collectors.counting()))
        .entrySet().stream()
        .filter(entry->entry.getValue() > 1)
        .map(entry -> entry.getKey())
        .collect(Collectors.toList());