- 博客(5)
- 资源 (1)
- 收藏
- 关注
原创 ThreadPoolExecutor构造函数各参数意义
ThreadPoolExecutor类是java的线程池实现的核心类,ThreadPoolExecutor类有四个构造方法,其中三个构造方法最终都是调用另一个参数最全的构造方法,这里整理一下各参数的意义及使用时的注意点,同时也能加强记忆。首先贴上jdk源码中的javadoc:/** * Creates a new {@code ThreadPoolExecutor} with the ...
2019-03-10 12:48:31 1815
原创 单例模式
单利模式的一种典型实现方式,双重检验锁。需要说明的是instance必须是volatile修饰的,因为instance = new SingleInstance()这句话在jvm中的执行步骤如下:1. 在堆内存中分配一个新的SingleInstance实例内存空间2. 执行SingleInstance构造函数3. 将新的实例的引用赋值给instance由于jvm会进行指令重排的优化,...
2019-03-08 19:42:07 124
原创 LinkedList源码阅读
拣几个重要的方法说一下:1. 首先是:addAll(int index, Collection<? extends E> c)方法,将给定集合中的所有元素添加到制定的下标处/** * Inserts all of the elements in the specified collection into this * list, starting at the speci...
2019-03-03 12:55:06 330
原创 ArrayList.removeIf 方法源码阅读
先贴上代码:public boolean removeIf(Predicate<? super E> filter) { Objects.requireNonNull(filter); // figure out which elements are to be removed // any exception thrown from the filter...
2019-03-03 00:25:59 518
原创 红黑树插入分析,java实现
不想打字,直接贴手写的稿纸吧^_^代码地址:https://github.com/zhuge134/data-structures-and-algorithm-learn/blob/master/src/main/java/com/zhuge/learn/dsaa/datastructure/tree/RedBlackTree.java实现不是很好,有待改进...
2019-03-02 21:31:48 150
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人