I have a need for a collection type, and it seems like it might already exist, but I can't figure out what it might be called so I can search for it. So far, my guesses turn up unrelated things.
The key attributes are:
- Stores key-value pairs like a HashMap
- Can be "cloned" by reference, i.e. you can make a mutable "clone" of the original, and the original is borrowed by the operation. But the "clone" operation is cheap, even if the collection has 10,000 entries.
- The new mutable clone can have entries added and removed, without affecting the original, which can still be read in an immutable form. (It's ok if the lookups take a little longer)
- Coolness if you would be allowed to re-merge a clone back into the original / replace the original with the clone. (Would only be sound if there were no outstanding clones other than the one being merged back in)
- Double-plus coolness if more complex merging operations were allowed, although conflict resolution could be a can of worms.
Basically, think of Git. Except dealing with abstract types instead of files, but Not attempting to merge within files (just handling adds and removes of entries), and living in ram as a collection type rather than manifesting in the filesystem as stand-alone software.
Does anything like this already exist? It seems like it might. What would one call something like this?
Grateful for any insight. Thank you all.