随笔分类 -  泛型

摘要:泛型中?的作用 概念 无边界通配符? 可以直接定义变量的 Point的定义 class Point<T> { private T x; private T y; public Point(){ } public Point(T x,T y){ this.x = x; this.y = y; } pu 阅读全文
posted @ 2023-08-29 17:09 SpecialSpeculator 阅读(71) 评论(0) 推荐(0) 编辑
摘要:泛型类,泛型方法的使用 传递入对象类型,返回出对象类型都是泛型 接口 public interface CloudParamGetter<IN, OUT> { OUT get(IN in); } 实现 public class VmParamGetter implements CloudParamG 阅读全文
posted @ 2021-06-01 15:34 SpecialSpeculator 阅读(60) 评论(0) 推荐(0) 编辑
摘要:1.泛型方法声明 放在返回结果前,进行修饰,传参List infoList 进行参数的泛型支持 public <T> List<SigmaInstance> generateInstancesByDataInfoList(List<T> infoList, Map<Long, GroupInfo> 阅读全文
posted @ 2021-03-10 10:10 SpecialSpeculator 阅读(107) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示