当前位置:网站首页>Object to map

Object to map

2022-07-19 05:36:00 Lun Zhi

//  Convert objects 
String securityDeviceString = JSON.toJSONString(hostDTOS);
hostDTOS.clear();
hostDTOS.addAll(JSON.parseArray(securityDeviceString, HostDTO.class));

// Object turn map
Map<String, HostDTO> bizMap = hostDTOS.stream().collect(Collectors.toMap(HostDTO::getId, Function.identity(), (b, a)->b));
原网站

版权声明
本文为[Lun Zhi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/200/202207170508072080.html