
JAVA
风中情
这个作者很懒,什么都没留下…
展开
-
java基础之List遍历速度
一、对ArrayList与LinkedList分别使用10w次不同的方式进行遍历,试了三次,结果如下 arrayList:for:12 arrayList:for-earch:11 arrayList:forEach:167 arrayList:parallelStream().forEach:18 arrayList:stream().collect:14 linkedList:for:13081 linkedList:for-earch:10 linkedList:forEach:7 linkedLi原创 2020-06-09 16:33:41 · 1021 阅读 · 0 评论 -
Mybatis参数传递记录
当对mybaits进行参数传递时 #{paramter} 表示一个'?' ${paramter}表示替换 例如: updateid=123 infoids=123,123 select * from test where updateid=#{updateid} and infoids in (#{infoids}) mybaitis打印出来的sql是 sele原创 2014-12-19 14:09:32 · 631 阅读 · 0 评论 -
AbstractQueuedSynchronizer分析
AbstractQueuedSynchronizer(同步器,以下称为同步器)提供了一个基于FIFO队列,可以用于构建锁或者其他相关同步装置的基础框架。一般要使用同步器,会自己实现一个同步器的子类并覆盖以下方法 方法名称 描述 protected boolean tryAcquire(int arg) 排它的获取这个状态。这个方法的实现需要查询当前状态是否允许获取,原创 2016-03-14 20:39:00 · 556 阅读 · 0 评论 -
java并发编程的艺术笔记——volatile理解
现象:A线程写一个volatile变量后,B线程读同一个volatile变量。A线程在写volatile变量之前所有可见的共享变量,在B线程读同一个volatile变量后,将立即变得对B线程可见。原理:1、从happen-before原则理解 线程A在写volatile变量之前的所有变量happen-before于当前volatile的变量 线程B在读volatile变量happen-...原创 2018-06-24 22:18:14 · 218 阅读 · 0 评论