hashmap源碼分析 hashmap和concurrenthashmap的區(qū)別,hashmap的底層源碼?
hashmap和concurrenthashmap的區(qū)別,hashmap的底層源碼?你好。當(dāng)并發(fā)訪(fǎng)問(wèn)可用時(shí),使用并發(fā)HashMap的效率要比使用鎖HashMap的效率高。concurrent Hash
hashmap和concurrenthashmap的區(qū)別,hashmap的底層源碼?
你好。
當(dāng)并發(fā)訪(fǎng)問(wèn)可用時(shí),使用并發(fā)HashMap的效率要比使用鎖HashMap的效率高。concurrent HashMap的功能還可以,但畢竟concurrent HashMap的數(shù)據(jù)結(jié)構(gòu)比較復(fù)雜。如果您可以確保只有一個(gè)線(xiàn)程可以讀寫(xiě)而沒(méi)有并發(fā)讀寫(xiě),那么可以嘗試HashMap。并發(fā)HashMap讀無(wú)鎖,寫(xiě)