java_基础 - YUHAO-ZX/StudyCollection GitHub Wiki
1.获取类加载的路径(排查包冲突问题)
StopWatch.class.getResource("").getPath();
result:file:/Users/niceday/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar!/org/apache/commons/lang/time/
2.AtomicBoolean
AtomicBoolean b = new AtomicBoolean(false);
if(b.compareAndSet(false,true)){
//初始化工作
}
此效率比synchronized,快至少3倍
3.android热修复
原理:获取classLoader进行动态替换
工具:tinker
链接:https://github.com/baidao/tinker-manager