摘要: Collection工具类 概念:集合工具类,定义了除了存取以外的集合常用方法。 方法: public static void reverse(List<?> List) //反转集合中元素的顺序 public static void shuffle(List<?> List) //随机重置集合元素 阅读全文
posted @ 2020-07-08 17:27 邱大将军 阅读(125) 评论(0) 推荐(0)
摘要: TreeMap 示例代码: public class Student implements Comparable<Student> { private String name; private int age; public Student() { } public Student(String n 阅读全文
posted @ 2020-07-08 16:58 邱大将军 阅读(112) 评论(0) 推荐(0)
摘要: HashMap源码分析 static final int DEFAULT_INITIAL_CAPACITY = 1 << 4; // aka 16 hasmap默认初始容量大小 16 static final int MAXIMUM_CAPACITY = 1 << 30; hashmap数组最大容量 阅读全文
posted @ 2020-07-08 16:33 邱大将军 阅读(116) 评论(0) 推荐(0)
摘要: Map接口的实现类HashMap 示例代码: public class Student { private String name; private int age; public Student() { } public Student(String name, int age) { this.n 阅读全文
posted @ 2020-07-08 15:52 邱大将军 阅读(193) 评论(0) 推荐(0)
摘要: Map接口 特点 子接口:SortedMap 实现类: TreeMap implement SortedMap HashMap Map接口使用 示例代码: /** * Map接口的使用 * 特点:1.存储键值对 2.键不能重复,值可以重复 3.无序 */ public class Demo { pu 阅读全文
posted @ 2020-07-08 15:51 邱大将军 阅读(116) 评论(0) 推荐(0)
摘要: Set接口 特点:无序、无下标、元素不可重复 方法:全部继承自Collection中的方法 Set接口使用 示例代码: /** * 测试Set接口的使用 * 特点:无序、无下标、不可重复 */ public class Demo { public static void main(String[] 阅读全文
posted @ 2020-07-08 13:41 邱大将军 阅读(137) 评论(0) 推荐(0)