collections.js - differance between SortedMap and SortedArrayMap
As stated on http://www.collectionsjs.com/map, maps are different as they work like dictionaries but accepting even objects as a key.
Reading the Dict documentation on http://www.collectionsjs.com/dict we understand that:
A dictionary is a specialized map. The keys are required to be strings.
An array is simply a data structure where you can insert anything using a simple push(thingToInsert)
. Items inserted into an Array are just values without a key to point to them.
At first glance, SortedArrayMap
uses a binary search strategy to maintain the order of the entries and is backed by an array, which means that use an array as a basic data structure(to maintain data of key). So that means in the end, that it uses a map based on SortedArray
class.
However, SortedMap
is a general key/value
collection, where you can access values with their relative key(quick access rather than an array order).
Anyway, if you want to dive a bit more into this topic, you can find a very good explanation on the is the official website of collections.js,