Java——把list转为List<clazz>类型
把list类型转为List<clazz> 类型,其中,值为null时转为空字符串
public static <T> List<T> listFomart(List list, Class<T> clazz) {
List<T> result = new ArrayList<>();
list.forEach(item -> {
result.add(JSON.parseObject(JSON.toJSONString(item, SerializerFeature.WriteNullStringAsEmpty), clazz, Feature.InitStringFieldAsEmpty));
});
return result;
}