报错:
java.lang.NullPointerException: element cannot be mapped to a null key
原代码:
Map<String,List<StCarIdentInfo>> map = list.stream().collect(Collectors.groupingBy(e->e.getTagId()));
原因:Map中不能有空的key
所以要在之前先把空key过滤掉!!!
代码修改为:
Map<String,List<StCarIdentInfo>> map = list.stream().filter(e->e.getTagId()!=null).collect(Collectors.groupingBy(e->e.getTagId()));