上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页
摘要: HashSet源码分析 基本说明 实现了Set接口 HashSet实际上是HashMap,这里可以看到HashSet的构造器走的是HashMap 3.可以存放null,但只可以存放一个null 4.HashSet不保证元素的存放顺序和取出顺序一致(可能一致也可能不一致) 5.不能有重复的元素(同Se 阅读全文
posted @ 2022-01-17 21:09 紫英626 阅读(32) 评论(0) 推荐(0) 编辑
摘要: LinkedList源码分析 ArrayList和LinkedList比较 ArrayList改查效率高是因为数组可以通过索引直接定位,LinkedList则需要从头遍历 另外这两个都是线程不安全的,在单线程的时候考虑使用 模拟双向链表 为了便于理解这里我们先模拟一个简单的双向链表: package 阅读全文
posted @ 2022-01-17 03:58 紫英626 阅读(20) 评论(0) 推荐(0) 编辑
摘要: Vector源码分析 Vector基本介绍 Vector与ArrayList的比较 源码解读——无参构造器 public class VecorSource { public static void main(String[] args) { // 使用无参构造器初始化Vector Vector v 阅读全文
posted @ 2022-01-17 01:54 紫英626 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 八位表示一个字节,所以只有八个全加器 能与1相加=0的数则是-1,我们将0000 0001 与 1111 1111相加得到1 0000 0000 因为全加器只有八位再向第九位进一的时候不会被接受,也可称之为溢出。 阅读全文
posted @ 2022-01-15 18:12 紫英626 阅读(21) 评论(0) 推荐(0) 编辑
摘要: ArrayList源码分析 注意事项 底层源码(重点、难点!!!) 使用无参构造器 public class ArrayListSource { public static void main(String[] args) { //使用无参构造器创建arraylist对象 ArrayList lis 阅读全文
posted @ 2021-12-30 20:17 紫英626 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 集合 学习注意点:具体应用场景和源代码的阅读 集合框架体系图(背下来!!!) 单列集合: 双列集合: Collection接口 常用方法 collection接口遍历方法 1.Iterator迭代器 package collection; import java.util.ArrayList; im 阅读全文
posted @ 2021-12-29 15:00 紫英626 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 1. public static void main(String[] args) { String s="abcdef"; System.out.println("交换前:"+s); try { s=reverse(s,1,4); } catch (Exception e) { System.ou 阅读全文
posted @ 2021-12-28 23:45 紫英626 阅读(41) 评论(0) 推荐(0) 编辑
摘要: System类 (1) 这里只执行了ok1 (2) public static native void arraycopy(Object src, int srcPos,Object dest, int destPos,int length); 参数说明: src:源对象srcPos:源数组中的起始 阅读全文
posted @ 2021-12-28 19:53 紫英626 阅读(29) 评论(0) 推荐(0) 编辑
摘要: Math类 基本介绍 常用方法 取a-b之间整数公式 int r =(int)(a+Math.random()*(b-a+1)); Arrays类 (1) int[] a= {1,45,56}; System.out.println(Arrays.toString(a)); //[1, 45, 56 阅读全文
posted @ 2021-12-28 17:30 紫英626 阅读(41) 评论(0) 推荐(0) 编辑
摘要: StringBuffer类 基本介绍 StringBuffer与String比较 构造方法 1. 2. 3. StringBuffer与String相互转换 1.String ->StringBuffer (1) (2) 2.StringBuffer ->String (1) (2) StringB 阅读全文
posted @ 2021-12-28 10:06 紫英626 阅读(25) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页

紫英