我的github
摘要: 2.1 新建 Comparator 比较器 List<Person> list = new ArrayList<Person>() {}; Collections.sort(list, new PersonComparator()); class PersonComparator implement 阅读全文
posted @ 2022-09-06 14:14 XiaoNiuFeiTian 阅读(34) 评论(0) 推荐(0)
摘要: 创建泛型集合List的时候报错,提示为:Type argument cannot be of primitive type 原因:泛型类型参数不能是原始数据类型,而应该是对象。因为在编译时会把带泛型的转换成Object类型,而基本数据类型不属于Object,所以比如想放int类型,就需要使用它的封装 阅读全文
posted @ 2022-09-06 11:50 XiaoNiuFeiTian 阅读(51) 评论(0) 推荐(0)