Map<Object, Long> a1Map = groupStoreVisiList.stream().filter(map->map.getA1() != null)//这里需要加个判断,该字段不能为null .collect(Collectors.groupingBy(p -> p.getA1(),Collectors.counting()));