//去除重复值
private IPage<SysLogNewsVO> getNewList(IPage<SysLogNewsVO> page,List<SysLogNewsVO> oldList){
HashMap<String,SysLogNewsVO> tempMap = new HashMap<String,SysLogNewsVO>();
List<SysLogNewsVO> currentPageList = new ArrayList<>();
StringBuffer readUser=new StringBuffer();
StringBuffer unReadUser=new StringBuffer();
//去掉重复的key
for(SysLogNewsVO vo : oldList){
String temp = vo.getNewsTitle();
if(tempMap.containsKey(temp)){
SysLogNewsVO newPerson = new SysLogNewsVO();
newPerson.setNewsTitle(tempMap.get(temp).getNewsTitle());
newPerson.setNewsRecord(tempMap.get(temp).getNewsRecord());
newPerson.setNewsType(tempMap.get(temp).getNewsType());
newPerson.setTriggerModel(tempMap.get(temp).getTriggerModel());
newPerson.setSendUser(tempMap.get(temp).getSendUser());
newPerson.setSendTime(tempMap.get(temp).getSendTime());
//合并相同key的value
if(vo.getIsRead().equals("1")){
readUs
java list合并相同数据为一条数据
于 2022-03-24 11:40:55 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)