Java -- change list to list < clazz > type
There is light ahead 2021-07-20 04:49:37

hold list Type to List<clazz> type , among , The value is null Time to empty string

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;
}

Please bring the original link to reprint ,thank
Similar articles

2021-07-20

2021-07-20

2021-07-20