原创 HashMap--resize方法

何時會擴容? 1、數組長度爲0 2、鍵值對超過閾值 3、在鏈表長度超過8要轉紅黑樹時,會看數組長度是否大於64,如果不是,也會先擴容 final Node<K,V>[] resize() { Node<K,V>[] ol

原创 HashMap--put方法

put方法源碼解析: (n-1)& hash 來定位桶的位置,爲什麼要這樣來定位呢? 因爲length=2^n對應的二進制中只有一個位爲1,如果直接計算h & length,那麼只能得到兩種結果(2^n或0),而length-1=2^n-

原创 HashMap--hash方法

有兩個問題需要面對: 1、爲什麼Object 需要hashCode() ? ①hashCode源碼 hashCode() 由C++實現,如下: // hashCode() generation : // // Possibilities

原创 concurrentHashMap 1.8 源碼解析

  /** * concurrentHashMap 的 put * @param key * @param value * @param onlyIfAbsent * @return

原创 HashMap---remove方法

remove方法源碼解析 public V remove(Object key) { Node<K,V> e; return (e = removeNode(hash(key), key, nul

原创 not in 的坑

  如果這麼寫是沒問題的:     select count(*) from quesgo_userinfo  where  uid not in (     select uid from quesgo_hdid where uid

原创 查看某個接口的所有實現類的UML圖

1、進入某個接口的Diagrams中 2、ctrl+A選中全部實現類,然後按enter

原创 負數的補碼

https://blog.csdn.net/weixin_38296030/article/details/88353914

原创 二叉樹

1、二叉樹源碼 package datastructure.tree; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstru

原创 AQS -- 公平鎖實現上鎖原理

public final void acquire(int arg) { /** * tryAcquire(arg): 嘗試獲取鎖 * acquireQueued :加入隊列

原创 MAC上面IDEA的快捷鍵

https://www.cnblogs.com/huiAlex/p/8594531.html   補充: ⌥+enter :自動生成類型  如:new Student();  和  getStudent(); 可以直接生成對應的類型和名稱

原创 mysql 分組查詢各組的前幾條數據

案例: 查詢某個年級每個班級的前三名的學生 create table group_order_3_test( `number_id` bigint(20) NOT NULL AUTO_INCREMENT,   `class` varcha

原创 mysql使用自定義變量實現窗口函數

create table income_tl( user_id int, create_date date, income int ); insert into income_tl values(1,'2016-03-01'

原创 多線程面試題

多線程面試題 https://www.cnblogs.com/dolphin0520/p/3932934.html

原创 Map源碼解析

HashMap的初始值的設定 https://www.cnblogs.com/super-chao/p/8377733.html