Is there a better key value list than hashmap?

I have heard that hashmap takes up a lot of space and its access efficiency is not high. Is there a better data type such as < key, value > for scenarios that do not need to modify and delete operations (such as building API with gson)?

May.28,2021

this is the fastjson constructor code

 
I heard that hashmap takes up a lot of space and access efficiency is not high

because it is HashMap , 25% of the space in the underlying array of hashcode, is wasted by default in data access.
but this is in order to have good random access ability

.

that is to say, if there is no need for random access, HashMap is indeed wasteful. For example, ArrayMap on Android is designed for scenarios with "no random access"

.

in addition, there are things like MultiValueMap , IntMap , which also provide special functions or special optimizations for special scenarios (although none of them are native to jdk)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb8402-4849f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb8402-4849f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?