3 ms·
> if I see someone use a linked list Or a hashmap to prepare 3 variables to pass to Json serialization.
by alexis_fr 7y ago
> if I see someone use a linked list
Or a hashmap to prepare 3 variables to pass to Json serialization.
- leetrout 7y agoI think that hits the human factor of software development where it is easier to conceptualize your hashmap will become that JSON object. Curious - what would be your solution? Just creating the json directly as strings / bytes?
- dasyatidprime 7y agoUnsorted-array-based maps are sometimes used in the Java world, and for two or three elements will have much less overhead than hash tables. For instance, fastutil has http://fastutil.di.unimi.it/docs/it/unimi/dsi/fastutil/objects/Object2ObjectArrayMap.html http://fastutil.di.unimi.it/docs/it/unimi/dsi/fastutil/objec.... The map interface and encapsulation into a single “object” is the same. It occurs to me that I don't know whether any of the major dynamic language implementations with maps/dicts/hashes as a central data structure use a similar approach for very small ones… huh.