企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
### 编写泛型 泛型(Generic)一般用在集合类中
 编写泛型时,需要定义泛型类型<T> ``` public class Pair<T> { … } ``` 静态方法不能引用泛型类型<T>,必须定义其他类型<K>来实现“泛型”: ``` public static <K> Pair<K> create(K first, K last) { … } ``` 泛型可以同时定义多种类型<T, K>。