Skip to content

Commit 9247561

Browse files
committed
feat(what is exception): exception
1 parent e6912a6 commit 9247561

20 files changed

Lines changed: 218 additions & 50 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
project目前完成度:
1010

11-
* [ ] 1.java基础与JVM书籍(5月中旬)(进度50%,待整理)(牛客网)
11+
* [ ] 1.java基础与JVM书籍(5月中旬)(进度70%,java基础完结)(牛客网)
1212
* [ ] 2.开源框架(6月中旬,需要mybatis,springboot等,牛客网)(进度:5%)
1313
* [ ] 3.mysql(7月中旬)(牛客网)
1414
* [ ] 4.算法框架(9月中旬)(进度:10%)

database/mysql/MySQL进阶技术.md

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,3 +2017,13 @@ INSERT INTO user VALUES (7, '王小花', 1000);
20172017
此时会发生什么呢?由于现在的隔离级别是 **SERIALIZABLE ( 串行化 )** ,串行化的意思就是:假设把所有的事务都放在一个串行的队列中,那么所有的事务都会按照**固定顺序执行**,执行完一个事务后再继续执行下一个事务的**写入操作** ( **这意味着队列中同时只能执行一个事务的写入操作** ) 。
20182018

20192019
根据这个解释,小王在插入数据时,会出现等待状态,直到小张执行 `COMMIT` 结束它所处的事务,或者出现等待超时。
2020+
2021+
2022+
2023+
2024+
2025+
2026+
left jion 和 right join 深入理解
2027+
2028+
2029+
with ~语句

database/mysql/problem.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
你有十亿的数据,怎么搞

database/mysql/senior.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# 本章节为MySQL进阶技术,以下为思维导图
2+
3+
<img src="https://picturestr.oss-cn-shanghai.aliyuncs.com/img/20200713220714.png" align="center" alt="数据库进阶学习导图">
4+
5+
_https://juejin.cn/post/6844903967365791752
6+
7+
MySQL 查询 树结构
8+
9+
https://blog.csdn.net/qq_34997906/article/details/94007556_
10+
11+
解决:Lock wait timeout exceeded; try restarting transaction
12+
13+
https://www.cnblogs.com/christopherchan/p/12390819.html
14+
15+
多个left join怎么保证正确
16+
17+
sql 查询树结构 递归向上或向下查找
18+
19+
```sql
20+
with org as (
21+
select id, name, path,order_no
22+
from auth.t_auth_org t
23+
where id =#{org.id}
24+
union all
25+
select distinct t1.id, t1.name, t1.path,order_no
26+
from auth.t_auth_org t1
27+
inner join (select id, name, org_type, p_id
28+
from auth.t_auth_org
29+
where id = #{org.id}) t2
30+
on
31+
t2.id = case when t2.org_type = 'c' then null else t1.p_id end
32+
)
33+
select di.detailed_type as detailed,
34+
count(*) filter ( where tgp.partition_code like '01%' ) as protectNum,
35+
case count(*) when 0 then 0.0 else round((count(*) filter ( WHERE tgp.partition_code like '01%'
36+
)/count(*)::numeric)*100,2) end as protectPct,
37+
count(*) filter ( where tgp.partition_code like '02%' ) as preventionPct,
38+
case count(*) when 0 then 0.0 else round((count(*) filter ( WHERE tgp.partition_code like '02%'
39+
)/count(*)::numeric)*100,2) end as preventionNum,
40+
count(*) filter ( where tgp.partition_code like '03%' ) as governmentPct,
41+
case count(*) when 0 then 0.0 else round((count(*) filter ( WHERE tgp.partition_code like '03%'
42+
)/count(*)::numeric)*100,2) end as governmentNum
43+
from groundwater.t_groundwater_detailed_info di
44+
left join groundwater.t_groundwater_partition tgp on di.id = tgp.detailed_id
45+
46+
inner join auth.t_auth_org tao on tao.id = di.org_id
47+
inner join org on tao.path ~ org.id
48+
where di.del_flag = false
49+
GROUP BY di.detailed_type
50+
51+
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
...in)是比特币(BitCoin)技术中的核心部分,其功能简单而言类似于一种账本,记录所有的交易数据。
2+
简而言之,区块链(Blockchain)就是通过去中心化和去信任的方式集体维护一个可靠数据库的技术方案。
3+
4+
https://wiki.mbalib.com/wiki/%E5%8C%BA%E5%9D%97%E9%93%BE
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BAAS ; Blockchain as a Service
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
全链路视频点播技术

fourgreatinvention/JDK的数据结构.md

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Queue是队列集合;Map代表的是存储key-value对的集合,可根据元
1313
上图中淡绿色背景覆盖的是集合体系中常用的实现类,分别是`ArrayList``LinkedList``ArrayQueue``HashSet``TreeSet``HashMap``TreeMap`等实现类
1414

1515
# 1 List家族
16+
1617
List<E>接口继承图:
1718

1819
<img align="center" src="https://picturestr.oss-cn-shanghai.aliyuncs.com/img/20200713221109.png"/>
@@ -68,55 +69,69 @@ List类在Java.awt包里,List<E>在java.util包里,但使用时是用List\<E>
6869
for(String item : list){
6970
System.out.print(item + " ");
7071
}//output:b
71-
72+
7273
}
7374
```
7475

7576
**注意**:输出的是`["a","b","c"]`,带有`[]`
7677

7778
### 1.1.2 List常用方法总结
79+
7880
#### (1)void add(Object element)
79-
向列表的尾部添加指定的元素
8081

81-
#### (2)int size()
82+
向列表的尾部添加指定的元素
83+
84+
#### (2)int size()
85+
8286
返回列表中的元素个数
8387

84-
#### (3)E get(int index)
88+
#### (3)E get(int index)
89+
8590
返回列表中指定位置的元素,index从0开始
8691

87-
#### (4)void add(int index, Object element)
92+
#### (4)void add(int index, Object element)
93+
8894
在列表的指定位置插入指定元素
8995

90-
#### (5)void set(int i, Object element)
96+
#### (5)void set(int i, Object element)
97+
9198
将索引i位置元素替换为元素element并返回被替换的元素
9299

93-
#### (6)void clear()
100+
#### (6)void clear()
101+
94102
从列表中移除所有元素
95103

96-
#### (7)boolean isEmpty()
104+
#### (7)boolean isEmpty()
105+
97106
判断列表是否包含元素,不包含元素则返回 true,否则返回false
98107

99-
#### (8)iterator()
108+
#### (8)iterator()
109+
100110
返回按适当顺序在列表的元素上进行迭代的迭代器
101111

102-
#### (9)boolean contains(Object o)
112+
#### (9)boolean contains(Object o)
113+
103114
如果列表包含指定的元素,则返回 true
104115

105-
#### (10)E remove(int index)
116+
#### (10)E remove(int index)
117+
106118
移除列表中指定位置的元素,并返回被删元素
107119

108-
#### (11)boolean remove(Object o)
120+
#### (11)boolean remove(Object o)
121+
109122
移除集合中第一次出现的指定元素,移除成功返回true,否则返回false
110123

111124
#### (12)void forEach(ConSumer<? super T> action)
112-
forEach是for的增强版 其中System.out::println这段代码其实就是Consumer<T>接口的一个实现方式
125+
126+
forEach是for的增强版 其中System.out::println这段代码其实就是Consumer<T>接口的一个实现方式
113127

114128
```java
115129
list.forEach(System.out::println);//output:b
116130
list.forEach(item->{
117131
System.out.println(item);//item就是list中的元素,便于对括号里面的元素做处理
118132
});//output:b
119133
```
134+
120135
#### (13)toArray
121136

122137
```java
@@ -126,18 +141,20 @@ list.forEach(System.out::println);//output:b
126141
list.toArray(arr);//此时arr就有了list中的值了
127142
//方法2,使用带参数的toArray方法
128143
String[] arr2=(String[])list.toArray(new String[0]);//参数含义的解释:要存储列表中元素的数组,如果它足够大的话;否则为此目的分配一个运行时类型相同的新数组。
129-
130-
144+
145+
131146
```
147+
132148
**注意:** 下面方法写法错误
133149

134-
> String[]arr=(String[])list.toArray();//会出现java.lang.ClassCastException
150+
> String[]arr=(String[])list.toArray();//会出现java.lang.ClassCastException
135151
136152
## 1.2 ArrayList
137153

138154
ArrayList是集合的一种实现,实现了接口`List`,List接口继承了`Collection`接口,而Collection是所有集合类的父类。ArrayList使用非常广泛,不论是数据库表查询,excel导入解析,还是网站数据爬取都需要使用到,了解ArrayList原理及使用方法显得非常重要。
139155

140156
### 1.2.1 定义一个ArrayList
157+
141158
```java
142159
List<String> list = new ArrayList<>();
143160
//默认创建一个ArrayList集合
@@ -230,17 +247,16 @@ public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAcce
230247
}
231248
}
232249
```
233-
从源码可以看出,ArrayList非线程安全,底层是一个`Object[]
234-
elementData`,添加到ArrayList中的数据保存在了elementData属性中,
235-
有第三个构造函数:`ArrayList()`、`ArrayList(int
236-
initialCapacity)``ArrayList(Collection<? extends E> c)`。
250+
251+
从源码可以看出,ArrayList非线程安全,底层是一个`Object[] elementData`,添加到ArrayList中的数据保存在了elementData属性中,
252+
有第三个构造函数:`ArrayList()``ArrayList(int initialCapacity)``ArrayList(Collection<? extends E> c)`
237253

238254
+ 当调用`new ArrayList<>()`时,将一个空数组{}赋值给了elementData,这个时候集合的长度size为默认长度0;
239255
+ 当调用`new ArrayList<>(100)`时,根据传入的长度,new一个Object[100]赋值给elementData,当然如果玩儿的话,传了一个0,那么将一个空数组{}赋值给了elementData;
240256
+ 当调用`new ArrayList<>(new HashSet())`时,根据源码,我们可知,可以传递任何实现了Collection接口的类,将传递的集合调用`toArray()`方法转为数组内赋值给elementData;
241257

242-
243258
#### tips:线程安全与线程不安全理解
259+
244260
线程安全就是`多线程访问`时,采用了`加锁`机制,当一个线程访问该类的某个数据时,进行保护,其他线程不能进行访问直到该线程读取完,其他线程才可使用。不会出现数据不一致或者数据污染。
245261

246262
线程不安全就是`不提供数据访问保护`,有可能出现多个线程先后更改数据造成所得到的数据是`脏数据`
@@ -259,34 +275,43 @@ initialCapacity)`、`ArrayList(Collection<? extends E> c)`。
259275
而如果是在多线程情况下,比如有两个线程,线程 A 先将元素存放在位置 0。但是此时 CPU 调度线程A暂停,线程 B 得到运行的机会。线程B也向此 ArrayList 添加元素,因为此时 Size 仍然等于 0 (注意哦,我们假设的是添加一个元素是要两个步骤哦,而线程A仅仅完成了步骤1),所以线程B也将元素存放在位置0。然后线程A和线程B都继续运行,都增加 Size 的值。
260276
那好,我们来看看 ArrayList 的情况,元素实际上只有一个,存放在位置 0,而 Size 却等于 2。这就是“线程不安全”了。
261277

262-
##### 不可变:
278+
##### 不可变:
263279

264280
不可变的对象**一定****线程安全**的,并且永远也不需要额外的同步
265281
因为一个不可变的对象只要构建正确,其外部可见状态永远也不会改变,永远也不会看到它处于不一致的状态。Java
266282
类库中大多数基本数值类如 `Integer``String``BigInteger` 都是不可变的。
267283
需要注意的是,对于Integer,该类不提供add方法,加法是使用+来直接操作。而+操作是不具线程安全的。这是提供原子操作类AtomicInteger的原。
268284

269285
### 1.2.2 数组、ArrayList中的区别
286+
270287
数组在内存中是连续存储的,所以它的索引速度是非常的快,而且赋值与修改元素也很简单,比如:
288+
271289
```java
272290
string[] s=new string[3];
273291
//赋值
274292
s[0]="a"; s[1]="b"; s[2]="c";
275293
//修改
276294
s[1]="b1";
277295
```
296+
278297
总所周知,数组在中间插入数据时,会移动后面的数据。而且在声明数组时,必须指明数组长度,长度过长会造成内存溢出,长度过短,会造成数据溢出错误,所以ArrayList对象可以克服这些缺点。
279298

280299
## 1.3 LinkedList
281300

282-
283301
## 1.4 Vector
302+
284303
## 1.5 CopyOnWriteArrayList
304+
285305
## 1.6 UnmodifiableList
306+
286307
## 1.7 SynchronizedList
287308

288309
# 2 Set家族
310+
289311
## 2.1 Set
312+
290313
## 2.2 HashSet
314+
291315
### 2.2.1 HashSet集合是不支持排序的,但是我们可以通过TreeSet集合对其进行间接排序
316+
292317
https://blog.csdn.net/jmj18756235518/article/details/81557356

languages/java/basic/JavaSE(三).md

Whitespace-only changes.

0 commit comments

Comments
 (0)