public static <T> List<T> listAndCast(Query query) {
@SuppressWarnings("unchecked")
List<T> list = query.list();
return list;
}
Run Code Online (Sandbox Code Playgroud)
在以下行中:
public static <T> List<T> listAndCast(Query query) {
Run Code Online (Sandbox Code Playgroud)
我们为什么需要<T>?