Skip to content

Consider allowing random access to lists in OrderedListMultimap #8

@sgodwincs

Description

@sgodwincs

During the implementation of OrderedSetMultimap, I realized this is a pitfall of the current OrderedListMultimap. While you can get an iterator over all values of a key, it does not support random indexing.

The obvious way to support this is to have each values of a key kept in individual lists, but this brings memory allocations per new key. I'm personally opposed to this, so the alternative is to keep an indirection map keyed on (KeyIndex, index into values). This does require another upfront memory allocation and extra bookkeeping, so currently keeping this as a potential avenue for improvements.

This is actually very similar to what I am implementing for OrderedSetMultimap, except the key is no longer based on an index into the values, but instead based on the value itself (i.e. it's a set as expected).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions