I've created a data structure that is a hash of arrays with a special property: the hash keeps track of the combined order in which items are appended to its arrays.
For example (pseudocode):
h = HashOfArray() h["a"].append(1) // accessing an unset key returns an empty array h["b"].append(2) h["a"].append(3) h["b"].append(4) h["a"] >>> [1, 3] h["b"] >>> [2, 4] h.items() >>> [1, 2, 3, 4]
I'm struggling with coming up with a good name for this data structure. Does it have a commonly used name? I've called it
HashOfArray but that fails to convey its main property: that it maintains the combined append order of the arrays.
Example implementation in Ruby: https://gist.github.com/kajic/7981533