stream取得List中不重复的项目的List<String>

Posted on 2020-02-29 09:56  wzhw2015  阅读(1433)  评论(0编辑  收藏  举报

List<String> itemList = list.stream().collect(Collectors.groupingBy(Bean::getItem)).keySet().stream().map(key -> key).collect(Collectors.toList());

Copyright © 2024 wzhw2015
Powered by .NET 8.0 on Kubernetes