Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple hash map like implementation.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 README
Octocat-spinner-32 hashmap.js
Octocat-spinner-32 test_hashmap.js
README
HashMapJS is simple hash map like implementation.

The keys and values can be arbitrary javascript objects.
There is no requirements on objects used as keys or values.

The mechanism is trivial. For every key there is generated unique id (per HashMap instance).
That id is injected to the key object under high unlikely to collide field name ;)

That id is then used to keying in the underlying baking standard javascript association object.

Notes:
1. This HashMap implementation is not thread safe.
  OK I know javascript is not multithreaded but it can have concurrent activities (e.g. setTimeout)
  This is enough to have race conditions.
  
2. The mentioned high unlikely to collide name is not a problem as log as there is no 
massively concurrent activities.

Roadmap:
1. Make the HashMap implementation thread safe by applying The Wallace Variation of Lamport's bakery algorithm.
http://www.polyglotinc.com/AJAXscratch/Mutex/mutualExclusion.html
Something went wrong with that request. Please try again.