Skip to content

Files

Latest commit

Jan 30, 2021
9e346e2 · Jan 30, 2021

History

History
32 lines (23 loc) · 900 Bytes

README.md

File metadata and controls

32 lines (23 loc) · 900 Bytes

LinkedMap

A LinkedMap is a order-aware collection with the following properties:

  • A head pointer
  • A tail pointer
  • A collection of items that can be added to, removed from, and traversed in either direction

I built this to have a collection I can traverse in either direction, but also be able to remove items in less-than-linear time. I also didn't want something that needed to be sorted or rebalanced after each addition or removal.

This uses Elixir's Map underneath, so removing arbitrary items can happen in logarithmic time, rather than linear time that most sorted collections incur.

Installation

Add linked_map to your list of dependencies in mix.exs:

def deps do
  [
    {:linked_map, "~> 0.2.0"}
  ]
end

Usage

See the documentation for API reference and examples.