随笔分类 - Java
摘要:1.继承关系图 2.Collection接口 Collection是最基本的集合接口,一个Collection代表一组Object,即Collection的元素(Elements)。一些Collection允许相同的元素而另一些不行。一些能排序而另一些不行。Java SDK不提供直接继承自Colle
阅读全文
摘要:转自: http://www.cnblogs.com/dolphin0520/p/3920397.html 1.简介 CountDownLatch和CyclicBarrier都能够实现线程之间的等待,只不过它们侧重点不同。 CountDownLatch一般用于某个线程A等待若干个其他线程执行完任务之
阅读全文
摘要:官方文档: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html 1.简介 An ExecutorService that executes each submitted task
阅读全文
摘要:1.常见停止方式 结束run函数,run中含退出标志位。 使用interrupt()方法中断线程 使用stop方法暴力终止(已经弃用) 2.结束run 调用testThread.stopThread就可以了。 使用场景无限制 3.使用interrupt()方法 3.1示例 3.1使用场景 适合线程处
阅读全文
摘要:转自 : http://docs.oracle.com/javase/1.5.0/docs/guide/misc/threadPrimitiveDeprecation.html 1.Why is Thread.stop deprecated? Because it is inherently uns
阅读全文
摘要:1.ReflectUtil.java package com.example.sjjg.java; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Metho
阅读全文
摘要:1.官方文档 Type Erasure https://docs.oracle.com/javase/tutorial/java/generics/erasure.html Erasure of Generic Types https://docs.oracle.com/javase/tutoria
阅读全文
摘要:1.官方文档 概述 https://docs.oracle.com/javase/tutorial/java/generics/wildcards.html 上限通配符 https://docs.oracle.com/javase/tutorial/java/generics/upperBounde
阅读全文
摘要:1.官方文档 https://docs.oracle.com/javase/tutorial/java/generics/restrictions.html Cannot Instantiate Generic Types with Primitive Types Cannot Create Ins
阅读全文
摘要:1.官方文档 https://docs.oracle.com/javase/tutorial/java/generics/bounded.html 2.作用 有时候为减少不必要的转换和运行时错误发生。可以对泛型形参使用 extends X 语句,指定泛型实参必需为X及其子类,那么潜在的错误在编译时就
阅读全文
摘要:1.官方文档 首页 https://docs.oracle.com/javase/tutorial/java/generics/index.html generic type type parameter(type variable) type argument parameterized type
阅读全文
摘要:1.相关文档 官 方 文 档 Java HotSpot VM Options https://www.oracle.com/java/technologies/javase/vmoptions-jsp.html open jdk 18 mark word源码 https://github.com/o
阅读全文
摘要:1.which java java命令位置 admin@ekfie:~/java/test ls -lrt
阅读全文
摘要:1.官方文档 源码、示例 https://github.com/openjdk/jol plugin for IntelliJ Idea https://github.com/stokito/IdeaJol 2.使用IntelliJ Idea 插件 2.1 线上安装 Settings/Prefere
阅读全文
摘要:1.官方文档 Type https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Type.html GenericDeclaration https://docs.oracle.com/javase/8/docs/api/java/la
阅读全文
摘要:1.要点 编译器会把 [ 变量 + "字符" ] 语句翻译成new 一个 StringBuilder对象并用它的append方法实现字符拼接。如果在循环语句中会频繁new StringBuilder对象,浪费时间。如:下面代码每次循环都生成两个StringBuilder对象。 String txt
阅读全文