This time, I didn't know how to add empty data to the list data obtained from the DB base, so I investigated various things, so I will leave it as a memo. There may be other easier ways, so I'd be happy if a kind person could tell me.
    //Add empty data to the top of the list
	public static <T> List<T> addEmptyItem(List<T> list, Class<T> clazz) throws Exception {
		list.add(0, clazz.getDeclaredConstructor().newInstance());
		return list;
	}
        Recommended Posts