Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HashMap UUID or String as key?

HashMap<UUID/String, Object> 

Which is better? I know UUIDs dont use that much memory but what is generally better to use?

like image 257
ntakouris Avatar asked Dec 12 '22 04:12

ntakouris


1 Answers

UUID takes up less space than the String does. Storing UUID itself via HashMap<UUID, MyObject> will conserve the space compared to HashMap<String, MyObject>.

like image 113
Rahul Tripathi Avatar answered Dec 13 '22 16:12

Rahul Tripathi