public static void test(){
List<DwMmDefVO> vos = new ArrayList<DwMmDefVO>();
DwMmDefVO temp = new DwMmDefVO();
temp.setDsName("name1");
temp.setDefType("Type1");
temp.setPk("PK1");
temp.setPkDs("DS1");
temp.setPkDef("def1");
vos.add(temp);
//遍历
vos.forEach(vo -> {
System.out.println(vo.getDsName()+ "---" + vo.getPath());
});
//获取(key value) 第三个参数能解决重复key的问题
vos.stream().collect(Collectors.toMap(DwMmDefVO::getPk,DwMmDefVO::getDsName,
(oldValue, newValue) -> oldValue));
//获取(key Object)
Map studentMap = vos.stream().collect(Collectors.toMap(DwMmDefVO:: getPkDef, (k) -> k));
//获取某一列数据
List<String> strs = vos.stream().map(DwMmDefVO::getDsName)
.collect(Collectors.toList());
//获取固定字符数据
vos = vos.stream().filter(x -> x.getDsName().equals("0"))
.distinct().collect(Collectors.toList());
//排序
vos = vos.stream().sorted((s1,s2) -> s1.getPkDs().compareTo(s2.getPkDs()))
.collect(Collectors.toList());
//分组
Map<String,List<DwMmDefVO>> group = vos.stream()
.collect(Collectors.groupingBy(DwMmDefVO::getDefType));
}