gistfile1.txt Map remarkMap = remarkList.stream(). collect(Collectors.toMap( FriendshipRemark::getFrAccountId, Function.identity(), (key1, key2) - key2, LinkedHashMap::new)); accountList.stream().forEach(n - { //获取备注名并放入nick中
MapremarkMap = remarkList.stream(). collect(Collectors.toMap( FriendshipRemark::getFrAccountId, Function.identity(), (key1, key2) -> key2, LinkedHashMap::new)); accountList.stream().forEach(n -> { //获取备注名并放入nick中 n.setNick(remarkMap.get(n.getId()) == null ? "" : remarkMap.get(n.getId()).getRemarkName()); });