一.源码解读 @SuppressWarnings("unchecked") public <T> T[] toArray(T[] a) { //size为集合的大小 int size = size(); //当传入数组大于集合大小时,r数组就是a数组,否则创建新的数组r,数组大小为集合大小 T[] r = a.length >= size ? a : (T[])java.lang.reflect.Array .newInstance(a.getClass().getC…
通过每块代码进行源码解读,并发现源码使用的技术栈,扩展视野. registerNatives 方法解读 /* register the natives via the static initializer. * * VM will invoke the initializeSystemClass method to complete * the initialization for this class separated from clinit. * Note that to use prop…
1.简介 ConcurrentLinkedQueue是JUC中的基于链表的无锁队列实现.本文将解读其源码实现. 2. 论文 ConcurrentLinkedQueue的实现是以Maged M. Michael和Michael L. Scott的论文Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms为原型进行改造的,不妨阅读此篇论文. 下面我将论文中的介绍的入队与出队用接近Java语言的…