It is much more difficult to judge yourself than to judge others. If you successfully judge yourself correctly, then you are a true wise man.红黑树红黑树实质上是一棵自平衡的二叉查找树,引入带颜色的节点也是为了方便在进行 ......
311
0
0
2022-11-26
字符串拆分 public static void main(String[] args) { String str = "I Live In The Home"; String[] ret = str.split(" "); for (String x : ret){ Syste ......
422
0
0
2022-11-26
His flower had told him that she was only one of her kind in all universe. And here were five thousand of them, all alike, in one single garden!Java Synchronized 关键字壹. Java并发编程存在的问 ......
364
0
0
2022-11-26
创建字符串常用的创建放到hi// 方式一 String str = “Hello”; // 方式二 String str2 = new String(“Hello”); // 方式三 char[] array = {‘a’, ‘b’, ‘c’}; String str3 = new String(array);intern()在实际开发中,String创建一 ......
318
0
0
2022-11-26
If you want to get to know butterflies, you have to endure the bites of two or three caterpillars.Lambda表达式jdk 1.8 新加入的特性,简化了简单接口的实现函数式接口函数式中只有一个待实现的方法,可以使用@FunctionalInterface注解标注 ......
420
0
0
2022-11-26
抽象类在运行时多态/动态绑定中通常会有些类中的方法没有具体的实现,而是在在被子类继承和重写之后才会安排具体的执行方法下面的代码就是以上所提到的情况:class Shape { public void draw() { } } class Cycle extends Shape { @Override publ ......
261
0
0
2022-11-26
Life is not a ridiculous number of life, the meaning of life lies in life itselfHashMap源码散列集数组和链表可以保持元素插入的顺序,对数组来说,他的优点是拥有连续的存储空间,因此可以使用元素下标快速访问,但缺点在于如果要在数组中第n位删除或插入一个新元素,就需要移动n后面的 ......
373
0
0
2022-11-26
多态的使用class Shape { public void draw() { } } class Cycle extends Shape { @Override public void draw() { System.out.println("○"); } } class R ......
223
0
0
2022-11-26
背景在继承的时候,子类需要创建构造方法时,必须要先给父类创建构造方法,再在子类的使用super()方法,代码如下class Room{ public int n; public String room; public Room(int n, String room) { this.n = n; ......
267
0
0
2022-11-26
向上转型背景代码:class Animal{ protected String name; //添加构造方法 public Animal(String name) { this.name = name; System.out.println("Animal(String)"); ......
337
0
0
2022-11-26
背景代码中创建的类, 主要是为了抽象现实中的一些事物.有的时候客观事物之间就存在一些关联关系, 那么在表示成类和对象的时候也会存在一定的关联.例如, 设计一个类表示动物class Animal{ public String name; public void eat(){ System.out.println("An ......
216
0
0
2022-11-26
The time you spend on your roses makes your roses so important.ArrayList 源码分析package Note.cistern; import java.util.ArrayList; public class ArrayListDemo { public static ......
355
0
0
2022-11-26
If you fall in love with a flower on a planet. Then, as long as you look up at the starry sky at night, you will feel that the stars are like flowers in full bloom.枚举类比单例模式,是一个特殊的类 ......
335
0
0
2022-11-26
顺序表需要有以下几点思考;顺序表中间/头部的插入删除,时间复杂度为O(N)增容需要申请新空间,拷贝数据,释放旧空间。会有不小的消耗。增容一般是呈2倍的增长,势必会有一定的空间浪费。例如当前容量为100,满了以后增容到200,我们再继续插入了5个数据,后面没有数据插入了,那么就浪费了95个数据空间顺序表的方法实现:import java.util.Arrays ......
280
0
0
2022-11-26
1.for循环手动拷贝直接使用for循环的方法进行拷贝,这种方法比较冗杂private static int[] copyArray(int[] array) { int[] temp = new int[array.length]; for (int i = 0; i < array.length; i++){ ......
428
0
0
2022-11-25