LS
06/27/2019, 3:46 PMmutableMapOf()
?
i need the map to be thread-safe, and also hold its entries in the order of insertion.karelpeeters
06/27/2019, 3:49 PMCollections.synchronizedMap(LinkedHashMap())
LS
06/27/2019, 3:49 PMkarelpeeters
06/27/2019, 3:50 PMif (x in map) println(map[x])
is still thead-unsafe.LS
06/27/2019, 3:51 PMbbaldino
06/27/2019, 4:17 PMCollections.synchronizedMap(LinkedHashMap())
over ConcurrentHashMap
?karelpeeters
06/27/2019, 4:20 PMConcurrentHashMap
is way better. synchronizedMap
just naively puts a single lock on everything, ConcurrentHashMap
actually allows things like overlapping reads etc.bbaldino
06/27/2019, 4:21 PM