HashMap<UUID/String, Object>
Which is better? I know UUIDs dont use that much memory but what is generally better to use?
HashMap<UUID/String, Object>
Which is better? I know UUIDs dont use that much memory but what is generally better to use?
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>
.
In general, the more specialized a type, the less waste there is, both regarding algorithms and storage.
Also, the data gets easier to manipulate.
Thus, if you know your argument is always a UUID, don't go for strings instead.
Ignoring that advice leads to a loosely typed mess, in extreme cases also known as stringly-typed-programs.
http://blog.codinghorror.com/new-programming-jargon
http://c2.com/cgi/wiki?StringlyTyped