3 ms·
> It would be great if you could have a std::vector or Python list of plain old objects, and then tell it to add an index (using a hashtable for example) on one
by ignoramous 4y ago
> It would be great if you could have a std::vector or Python list of plain old objects, and then tell it to add an index (using a hashtable for example) on one or two of the fields.
This is what a LinkedHashMap (1 index) and HashBasedTable (2 indices) do in the jvm-land. Admittedly, there isn't a convenience api to convert a given collection/vector to a map/table (but hey, if you're like me and write a lot of golang, then the current jvm-land status quo is already heaven!).
https://guava.dev/releases/snapshot-jre/api/docs/com/google/common/collect/HashBasedTable.html https://guava.dev/releases/snapshot-jre/api/docs/com/google/...