脚本宝典收集整理的这篇文章主要介绍了

Java 泛型

脚本宝典小编觉得挺不错的,现在分享给大家,也给大家做个参考,希望能帮助你少写一行代码,多一份安全和惬意。

简介

Object & <?> & <T>

<T> T

reference

public static <T> List<T> backwards (List<? super T> input) {          List<T> output = new ArrayList<T>();          return output;   }
<T>
I'm declaring an arbitrary type T for this method, which can be anything (non-primitive) for each call of the method.
List<T>
This method will return a List containing elements of that type T.
List<? super T> input