stream Collectors.toMap实现List<Bean>转Map<String,Bean>

Posted on 2020-02-29 14:35  wzhw2015  阅读(1820)  评论(0编辑  收藏  举报

Map<String,Bean> map = list.stream().collect(Collectors.toMap(bean -> bean.getItemA(),bean->bean));

Copyright © 2024 wzhw2015
Powered by .NET 9.0 on Kubernetes